Marking a razor from another assembly

Can I use a layout from another assembly? I used my application in different layers and had a separate user interface layer that contains a master layout for editing designers.

Is this possible, and what would I like my link to look like?

@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } 
+4
source share
2 answers

You can take a look at the following article , which illustrates the technique for viewing Razor in a separate assembly.

0
source

In the end, by the time you launch the website, you need to collect all kinds, including layouts, in a known place.

In this case, you can copy the general views as root

 <siteroot>/Views/Shared/ 

With this assumption, you can reference these layouts the way you do it. However, visual studio or tools like resharper continue to show this as a bug. You need to get settled with these errors.

0
source

Source: https://habr.com/ru/post/1393536/


All Articles