Virtual Path Attribute

Sep 19, 2013 at 1:30 PM
Hey,

In the generated .cs files which are created from running the custom tool, we see the line :
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Default/DisplayWWW.cshtml")]
In our application, we potentially have several views from different projects which live in 'Default/DisplayWWW.cshtml'. Is there an easy way to add a custom namespace to this path to disambiguate it?

Thanks,

Garry
Coordinator
Sep 19, 2013 at 2:30 PM
There isn't a way to modify the page virtual path as yet. It shouldn't be hard to change the generator to support this. However once the virtual path is namespaced, you'd have to change your controller to return the right "namespaced" View. At this point, you're better off using Areas as a simpler mechanism for achieving this - you get namespacing for free and don't quite have to bother with modifying your controller. Does this make sense?
Coordinator
Sep 19, 2013 at 4:46 PM
We you instantiate PrecompiledMvcEngine, you can pass a baseVirtualPath as the second param, which lets you change the effective virtual path for all the pages within an assembly. You may want to play around with that.