Home > Net >  ASP.NET 4.7 - Subfolder inside Content not deployed to cloud
ASP.NET 4.7 - Subfolder inside Content not deployed to cloud

Time:03-19

I have just deployed my first ASP.NET 4.7 Application to Azure but on the deployed website the background image is missing. The background image loads without problem on local server and it is located in /MyApplication/Content/Images/bg.jpg.

I tried to log on to Azure console and found that in fact the entire Images folder is not uploaded (but the other files in the Content folder are there). How do I include the Images folder when deploying to Azure? Is there some settings that I need to adjust during deployment or codes that I need to change in my Application?

Thank you.

CodePudding user response:

After reproducing from our end we have observed that in order to make the folder content visible it needs to hold some files. We have manually added files by navigating through folder explorer but couldn't able to see any file being added in VS. So after adding the below lines to .csproj we could able to see the folder and its contents being added after deployment.

<ItemGroup>
    <Content Include="Content\Images\**\*" />
</ItemGroup>

RESULT:

enter image description here

enter image description here

REFERENCES: How to include custom folders when publishing a MVC application?

  • Related