Sharing ASP.NET MVC partial views between projects

Viewed 3330

What is the best way to share a common Partial View between applications? I've created a separate assembly containing my Partial View in an ascx file, some scripts that go with that view and an HtmlHelper extension method to make creating the partial view easier. However, when referencing that assembly from an ASP.NET MVC application, it can't find the partial view as the ascx file is not copied as well. Also, what is the best way of including the attached scripts with the application? The only way I can see at the moment is to copy the relevant files to the new application.

4 Answers

This post discusses how to embed a view in a DLL and render it from a different project. I guess it'll work for partials as well, but I haven't tried it.

Related