Tony
Tony

Reputation: 41

Visual Studio 2019 failed to update wwwroot folder content in Azure web app

I have an Angular and C#/Dotnet Core 5.0 api application. The C# code and Angular are in different folders. I compiled angular code with ng build --prod. Then I copied *.js files from angular dist to wwwroot folder in C# project, e.g. myapi/wwwroot. After publishing from Visual Studio 2019 to Azure web app, the content of D:\home\site\wwwroot\wwwroot does not get updated. In the obj\Release\net5.0\PubTmp\Out\ I saw a wwwroot folder, but the content is old. The new files from myapi/wwwroot folder is not copied over. Any suggestions are really appreciated.

Upvotes: 2

Views: 1148

Answers (2)

Jacob Jarick
Jacob Jarick

Reputation: 63

I had the same/similar issue which was resolved by deleting the folders

projectroot/bin
projectroot/obj

please also set the file properties in solution explorer to "copy if newer" as shown in the image below

file properties

Upvotes: 0

Bhargavi Annadevara
Bhargavi Annadevara

Reputation: 5512

Please verify your cproj file and check if they're being excluded. You can add this to your csproj file to have the content of wwwroot copied over:

<ItemGroup>
  <None Include="wwwroot\**">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
   </None>
</ItemGroup>

Upvotes: 1

Related Questions