Reputation: 40573
I have a couple of pages common across all my ASP.NET projects. I would like to centralize that code inside a single assembly. How can I achieve this? Is it possible to simply create and assembly and add it as a reference of my ASP.NET projects and the pages are going to be accessible?
Upvotes: 8
Views: 3358
Reputation: 139758
Using razor views from a different (so from outside the web project) is not supported out of the box. However there a tool to precompile razor views and then you can put them in any dll. This custom tool is called RazorGenerator.
There are some blog posts where you can start:
Precompile your MVC Razor views using RazorGenerator
Compile your asp.net mvc Razor views into a seperate dll
Upvotes: 4