I thought I would ask this here, since it will help others.
Apparently in .NET Core 2, at least when using App Services and Web Deploy, razor views are not deployed directly via the file system, as .cshtml files. Rather, it seems they are packaged into a DLL called [Project].PrecompiledViews.dll ... If you are using UseFilesystemProject(), this leads to problems the first time you leave development and deploy to a server.
I am currently trying to figure out how to work around this. I've tried:
Rather than iterate all the possibilities for solving this, it's probably best to just ask: am I missing something, and what's the best practice for a simple case like this?
Thanks for the great project, I appreciate you. :)
Hi @kinetiq,
As workaround you can also use
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
in web.config to avoid View precompilation on publish.
Although this is only a workaround for now...
Source: https://neelbhatt.com/2017/08/27/razor-pages-compilation-on-publish-a-net-core-2-0-feature/
Thank you for the response. Please put this in the docs for others, I spent over 4 hours on this. :)
Thank god for this question. I would indeed really recommend that you (@Gerfaut) add the following note under the "File source" section of your readme:
As of ASP.NET Core 2.0 you need to make sure the views are included in the publish by adding the following to your project.csproj file, otherwise it wont normally be included in your published/production environment.
<PropertyGroup>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
</PropertyGroup>
Most helpful comment
Thank god for this question. I would indeed really recommend that you (@Gerfaut) add the following note under the "File source" section of your readme: