Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If Views are in a different project than the hosting class the views won't be found #93

Open
mastoj opened this issue Nov 25, 2013 · 2 comments

Comments

@mastoj
Copy link
Contributor

mastoj commented Nov 25, 2013

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 in RazorViews removes the bin/debug part of the file path which is needed I think if you have the hosting and application separated.

@ianbattersby
Copy link
Collaborator

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;

  1. Some syntax in "ViewPath:Value" to denote absolute path (would this work for you?)
  2. Use the "ViewPath:Value" value to define a relative path (e.g. "../../MyViewsAssembly/Views")
  3. Allow override of AppRoot through Simple.Web.Configuration

Thoughts @markrendle?

@mastoj
Copy link
Contributor Author

mastoj commented Nov 25, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants