我正在尝试为我们的项目构建CI CD Pipeline。当我的应用程序开始构建。我们遇到了问题。
C:\ Program Files \ dotnet \ sdk \ 2.2.104 \ Sdks \ Microsoft.NET.Sdk \ targets \ Microsoft.NET.Publish.targets(141,5):错误MSB3030:无法复制文件“D:\ a \ 1 \ s \ src \ VTTDemo.Web.Host \ wwwroot \ dist \ 101.7d2715da89efeae8b0da.js“因为找不到它。 [d:\一个\ 1 \ S \ SRC \ VTTDemo.Web.Host \ VTTDemo.Web.Host.csproj]
步骤如下。 1.从解决方案资源管理器配置Cd 2.输入应用程序,Azure登录3.选择项目和管道4.编辑管道5.保存并排队管道
在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>