ErocM
ErocM

Reputation: 4662

Access a Razor View from another project

I have a MVC project that is using Razor Views for my website. One of my projects, lets call it project1 is complete and in use.

I would like to access a view in project1 from project2 so that I do not have to maintain both screen.

They are both in the same solution.

I cannot change project1 since it is already in use by our customers. I looked at the Razor Single File Generator but that is quite drastic for 1 screen and I cannot change project1 that is in use already.

How do I reference the view from project1 in my project2?

Thanks!

Upvotes: 5

Views: 3250

Answers (1)

Dmitry Efimenko
Dmitry Efimenko

Reputation: 11188

You could compile your views from project2 into a dll and reference that dll in project1.

Follow this tutorial to compile a view into a dll.

Upvotes: 2

Related Questions