Using Views From a Class Library

asp.net-mvc-5, c#, entity-framework, entity-framework-6, visual-studio-2013

Solution

Here is a good blog post that will show you how:

http://www.danielroot.info/2013/07/reuse-mvc-views-using-virtual-path.html

Or you can use the Razor Generator project from codeplex:

http://razorgenerator.codeplex.com/

In order to get intellisense you need to make sure you have a web.config in the folder with the views.

Problem

I have heard that you can use views in a class library now in MVC5. However I can't seem to find any guide on how to actually do this. I have created a web app, created a class library and installed the MVC package in that library. I have a controller and a view in the library and I have referenced the library from the web app. This doesn't work and to be honest I didn't expect it to. It feels like I'm missing another link that ties my app to the view in my library. How do I get the app to look in the library for views?

Original source

Related problems