In Visual Studio 2017, when I want to create an ASP.NET Core Web Application from scratch using either one of these standard .NET Core project templates:
These project templates; obviously would not include the wwwroot
folder. So, when I add the folder to my project it will look like (and behave like) a standard folder:
When you create it using the ASP.NET Core Web Application project template, the wwwroot
folder looks like this:
Question - Appearance (Icon)
How do you change the icon of the
wwwroot
folder to look like the one found in the ASP.NET Core Web Application project template?
Additional Question - Behavior (Copying Files to Output Directory)
In the standard .NET Core project, I would have to add this to my .csproj
file:
<ItemGroup>
<Content Include="wwwroot\**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
so that it copies all my files from the wwwroot
folder to the output directory similar to the ASP.NET Core Web Application project. I looked in the ASP.NET Core Web Application's .csproj
file and didn't see anything like that.
I'm assuming the answer to the main question will also provide the answer for this one, as the project templates are obviously different. I can't seem to find the resources online to help me manually edit this myself.
Thanks in advance.
After reading this page that announced the new tooling in Visual Studio 2017, I found out that it was in fact possible.
I noticed that the ASP.NET Core Web Application project uses a different value under the
Project
node in the.csproj
file.<Project Sdk="Microsoft.NET.Sdk.Web">
Whereas the standard project templates used Microsoft.NET.Sdk
like this:
<Project Sdk="Microsoft.NET.Sdk"> ← ← ← ← //change this to Microsoft.NET.Sdk.Web
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
</Project>
Once I changed the value to Microsoft.NET.Sdk.Web
and saved the csproj
file, the project upgraded itself, and the wwwroot
folder was added to my project automatically (but excluded), like this:
Then I included it into the project and now:
Great! I hope this answer helps others.
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