RazorGenerator not using files on disk if newer
See original GitHub issueWe currently have an issue where we always have to build our project to see changes to razor files, despite UsePhysicalViewsIfNewer
being set to true.
I’ve set up a scenario where I can debug RazorGenerator.MVC and, putting a breakpoint into IsPhysicalFileNewer()
I can see that it’s not even being called by the framework after the first build for the particular view that I’m interested in.
I’m not sure where to progress to next in order to fix this - any ideas?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
UsePhysicalViewsIfNewer not working · Issue #111
We determine the physical path for files using HostingEnvironment.MapPath . I'm not entirely sure what it would take to map it back to...
Read more >Razor Generator Build Action - asp.net mvc
The purpose behind Razor Generator is that it pre-compiles your razor views, translating the markup in your cshtml files into C# code that ......
Read more >An interesting side effect of compiled views - Jeremy Davis
UsePhysicalViewsIfNewer enabled and disabled, with view files present and not present, and using both Partial and ViewRendering bindings. Under ...
Read more >Sharing Views in MVC — A Quick Start with ...
When you do this, you'll see that a new class — RazorGeneratorMvcStart — was added to the App_Start folder. Step 5: Create a...
Read more >Helix - Sitecore Shack - WordPress.com
One such issue presents itself when using RazorGenerator. ... Sitecore solution whether it's Helix compliant or not… how we handle old files in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Views in a separate assembly wouldn’t work. The view engine has no idea where your app is located to cause the refresh.
Just wanted to add that we’re seeing a similiar/related issue-- but in our case it’s causing an exception to fire; we’re getting an “Object reference not set to an instance of an object.” error about a partial view (
_LandingPageFloorContent.cshtml
) that uses a model, that actually has nothing to do with the view being rendered/requested (hence empty Model and object reference error). Very odd. Here’s the stack trace:We’re getting this error after building -> making a change to .cshtml file -> reloading the page. If we build again, the view works properly again until it’s changed.
I think perhaps RazorGenerator is getting confused/collisions on view names – we are trying to load an
Home/Index.cshtml
view inside of an Area-- but we also have a non-areaHome/Index.cshtml
in our general Views folder.I’m going to try and dig further on it, but if this helps anyone on the team with diagnosing, great.