In an attempt to have several sites with one central set of views I created an external library with my views. They are marked as content and copy always.
This views library is referenced in my websites and thus with compiling get a "Views" folder in their bin folder.
Then I made a quick custom ViewEngine like this:
public class CommonViewLocator: WebFormViewEngine
{
public CommonViewLocator()
{
MasterLocationFormats = new[] {
"~/bin/Views/{1}/{0}.master",
"~/bin/Views/Shared/{0}.master"
};
ViewLocationFormats = new[] {
"~/bin/Views/{1}/{0}.aspx",
"~/bin/Views/{1}/{0}.ascx",
"~/bin/Views/Shared/{0}.aspx",
"~/bin/Views/Shared/{0}.ascx"
};
PartialViewLocationFormats = ViewLocationFormats;
}
}
After running I get this screen:
The view 'Index' or its master could not be found. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/bin/Views/Home/Index.aspx
~/bin/Views/Home/Index.ascx
~/bin/Views/Shared/Index.aspx
~/bin/Views/Shared/Index.ascx
What's going wrong?
Also, it feels kinda weird that the bin folder has the views, any other suggestions are welcome.