Jeff
Jeff

Reputation: 4820

MVC Razor Shared external layout

I'm looking for a way to reference a shared external _layout.cshtml from MVC 3 and Razor.

A little back story: We have multiple developers. All of them are working on separate MVC applications that all need the same look and feel. All these applications will be deployed to the same site for example http://www.example.com/App1/ and http://www.example.com/App2/

The look and feel will be generated by the CMS and dropped into a different folder http://www.example.com/Layout/_layoutExt.cshtml

I've tried

MasterName = @"C:\inetpub\wwwroot\layout\_LayoutExt.cshtml";

But it gives me the error that it can't find the file

The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched.

Upvotes: 2

Views: 1356

Answers (2)

Jeff
Jeff

Reputation: 4820

My eventual solution was to use Symbolic links (or junctions or hard links) to link the needed file into the view folder. This way the CMS writes to one location and my app reads from another. Not the clean solution I was looking for.

Upvotes: 1

Fabian Vilers
Fabian Vilers

Reputation: 2982

You'll probably need to make your own view engine that support reading file outside the web application home directory.

Upvotes: 0

Related Questions