I started out with a simple MVC-site using NancyFx with Razor-views (.cshtml
) and Nancy.Hosting.Aspnet
, using IIS Express. Now I adapted the project to a self-hosting service using Nancy.Hosting.Self
(and TopShelf).
However, to provide the Views, it seems I need to change their properties from None
& Do not copy
to Content
& Copy if newer
, so they are copied to .\bin\Debug\
.
One consequence is that changes to the Views will not be shown/updated until a restart. Even when working in debug-mode, where caching is disabled by default. I know this is just a minor annoyance, but still an annoyance, and it is nice to be able to try (cs)HTML-changes right away. So I was wondering is there a way to fix this, e.g. to prevent having to set the files to Copy if newer
?
You can provide a custom root path that looks directly at the views folder in your project.
You will need to set these values:
#if DEBUG
StaticConfiguration.Caching.EnableRuntimeViewDiscovery = true
EnableRuntimeViewUpdates = true
#endif
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