Open mastoj opened 10 years ago
Well spotted! That would indeed be a problem if your views are separate from hosting.
There are obviously many ways to skin this cat, thoughts include;
Thoughts @markrendle?
One more remark. I'm not sure if my description is complete. I tried copying the application to a path that didn't include bin or debug, but that didn't help either which I thought would fix the problem. I might have done something wrong when I did the test since I only had one minute this morning.
To your suggestion, 1. could work for simple scenarios but that means you are tightly coupled to the hosting environment in a way. I think override of AppRoot is the best solution.
However, there is an additional problem with this scenario and that is during development. It might be harder to keep update the view when developing, but that might be solvable with setting the "ViewPath:Value" to a relative path during development.
I have a sample project showing the problem: https://github.com/mastoj/NestDemo/tree/DecoupleHosting
I am doing self hosting in two different ways. First I had it in the NestDemo project, but than I wanted to decouple hosting from application and tried to put the hosting in a separate project, NestDemo.SelfHost. That didn't work since
AssemblyAppRoot
inRazorViews
removes the bin/debug part of the file path which is needed I think if you have the hosting and application separated.