.net core 6 is out with a lot changes and some new cool stuff. I decided to test it by creating a MVC web application. Let’s create Net6CoreMVCDemo
By the way, startup.cs disappeared, or its content is being moved to Program.cs. This make sens to me , did not get the reason on having 2 files that play sthe same role: configuring the application.
After creating my MVC app, the site works fine when I hit debug.
Press F5 will run the app with IIS Express and everything is running Fine.
Problem:
Then I decide to run my app using the generated executable. This is the same as deploying the application in IIS server. In my folder \Net6CoreMVCDemo\bin\Debug\net6.0
- I do not see the wwwrootfolder
- Runing the Net6CoreMVCDemo.exe see the image result
The styles is not display and some missing JS files are shown in the console
Solution
Solution is easy actually, if you run into this. Please add the following code in the project.csproj file and voila!
<ItemGroup>
<None Include="wwwroot\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>