I have the following on an ASP.NET Core 3.1 csproj file:
<ItemGroup>
<Content Include="webroot\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Target Name="Approot" BeforeTargets="BeforeBuild;BeforePublish">
<Exec WorkingDirectory="approot" Command="npm install" />
<Exec WorkingDirectory="approot" Command="npm run build --prod" />
</Target>
I am building a Client application in approot
folder and saving the result to webroot folder.
I need the webfoot folder to be copied to the Output directory ...
Problem
When I build it files are placed on webfoot folder but it is not copied to the Output.
So I need to rebuild it again so that webroot folder is copied to the Output ...
It seems that the 2 npm commands are being ran after the Build but I am using BeforeBuild.
Try this
<ItemGroup>
<None Include="wwwroot\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With