When running 'dotnet watch run' on MacOSX views on disk doesn't get served when they are updated.
Have added this as suggested in other bug reports and stackoverflow replies without any luck.
I have no views compiled into a dll of any kind.
<PropertyGroup>
<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompileOnPublish>false</RazorCompileOnPublish>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
</PropertyGroup>
Steps to reproduce the behavior:
To be able to see the updated views without having to restart the process
Same on Windows. I have to restart the debugger each time I update a view or a razor page. It's really time consuming.
In ASP.NET Core 2.2, the default behavior of razor and views is that .cshtml should be re-compiled at runtime without restarting the process. MVC has its own file watcher on *.cshtml files and should be refreshing views when the .cshtml changes. For this reason, dotnet-watch does not restart when *.cshtml files change.
cc @mkArtakMSFT @pranavkm
Starting in 3.0, runtime compilation is not enabled by default and we compile views and pages as part of the normal build. We should update all of our auto-build experiences to build .cshtml and .razor files by default (tracked by this issue), and then have some way for runtime compilation to disable auto-build for .cshtml if runtime compilation is enabled (#9641).
@natemcmaster correctly pointed out this is an issue with 2.2. In 2.2, runtime compilation works in tandem with build time compilation and these changes should get picked. However, you could give the file watcher an additional nudge by setting DOTNET_USE_POLLING_FILE_WATCHER in case the dotnet file watcher is having trouble. See https://github.com/aspnet/Mvc/issues/7028#issuecomment-342217586.
One more thing, if you want to customize the behavior of dotnet-watch to include *.cshtml files, you can do that by customizing your project file. See https://docs.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch?view=aspnetcore-2.2#customize-files-list-to-watch