CI CD 管道 Azure Devops

CI CD pipeline Azure Devops

我正在尝试为我们的项目构建 CI CD 管道。 当我的应用程序开始构建时。 我们遇到问题了。

[error]C:\Program Files\dotnet\sdk.2.104\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(141,5): 错误 MSB3030: 无法复制文件 "D:\a\s\src\VTTDemo.Web.Host\wwwroot\dist1.7d2715da89efeae8b0da.js" 因为没有找到。

C:\Program Files\dotnet\sdk.2.104\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(141,5): 错误 MSB3030: 无法复制文件"D:\a\s\src\VTTDemo.Web.Host\wwwroot\dist1.7d2715da89efeae8b0da.js" 因为没找到。 [D:\a\s\src\VTTDemo.Web.Host\VTTDemo.Web.Host.csproj]

步骤已跟进。 1. 从解决方案资源管理器配置 Cd 2.进入应用程序,Azure登录 3. Select 项目和管道 4.编辑管道 5. 保存并排队 Pipeline

关于 GitHub 的解决方案问题 - https://github.com/aspnet/websdk/issues/162

解决方案代码

需要在csproj文件中添加如下代码:

  <ItemGroup>
    <Compile Remove="node_modules\**\*;Client\**\*" />
    <Content Remove="wwwroot\dist\**\*" />
  </ItemGroup>

  <Target Name="RunWebpack" BeforeTargets="BeforePublish">
    <Exec Command="npm run clean:dist" />
    <Exec Command="npm run build:prod" />
    <ItemGroup>
      <DistFiles Include="wwwroot\dist\**\*" />
      <Content Include="@(DistFiles)" CopytoPublishDirectory="Always" />
      <ContentWithTargetPath Include="@(DistFiles)" TargetPath="%(Identity)" CopyToPublishDirectory="Always" />
    </ItemGroup>
  </Target>