c# - How can I reference a Master view in a different project in ASP.NET MVC? -


I am creating an ASP.NET MVC solution, and I had 2 MVC website projects inside.

I am interested in creating a third project called "Share", where I can reference the views / content shared between two sites, so I have only one place to edit them .

  • WebUI site1 (ASP.NET MVC site)
  • WebUI.Site2 (ASP.NET MVC site)
  • WebUI.Shared (newly created ASP .NET MVC site)
  • I can refer to the location of a Masterview, to find out how it is in a different project

    So, on the top of a scene normally I There are references like Masterview> & lt;% @ page title = "" language = "c #" MasterPageFile = "~ / visible / shared / tabbed.master" Inherits = "System.Web.Mvc.ViewPage & LT ; WebUI.ViewModels.Admin.EditProfileViewModel> "& Gt%;

    However, this "tabbed. Mister" is not in the local project, this solution is a difference project, I have made a reference to the project , But I do not know how to write WebUI.Shared from WebUI.Site1 to Tabbed.Master

    like:

      & lt;% @ Page Title = "" Language = "C #" MasterPageFile = "WebUI.Shared.Views.Tabbed.Master" Inherits = "System.Web.Mvc.ViewPage> WebUI.ViewModels.Admin.EditProfileViewModel>" & Gt%;  

    is not working.

    How can I reference the location of images such as mastertive, CSS files, such as images in projects?

Due to the nature of the masterview, you need to find a filebase solution Virtual Path One way to do this But I think you'll find trouble in some time: How do you handle file references when you use the internal Visual Studio Web server?

And when this virtual path is lost in IIS, then you feel the pain of pain.

Visual Studio lets you link files to other projects, those files will be copied at compiled time:

Right-click in the Solution Explorer -> Add existing items ... -> Choose File -> Add as Link

Personally, I do not care about this feature. But it seems like what you want


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -