Tuesday, June 21, 2011

BIN Deploying ASP.NET MVC 3 with Razor to a Windows Server without MVC installed

Scott Hanselman discussed in his blog some time ago the challenge with deploying MVC 3 applications where MVC is not installed on the server. He described several options.

I am not challenging that the different options that he offers come with different advantages and disadvantages. So it is essentially up to you to decide which option you want to use.

In this post I want to summarize the option that I used for a deployment where MVC 3 was not installed on the server. In a first step I created a web site project and inside of the project folder I created a folder that I named “mvc3”. Inside of that folder I copied the following assemblies:

  • Microsoft.Web.Infrastructure.dll
  • System.Web.Helpers.dll
  • System.Web.Mvc.dll
  • System.Web.Razor.dll
  • System.Web.WebPages.Deployment.dll
  • System.Web.WebPages.dll
  • System.Web.WebPages.Razor.dll

Next I added all of these as references to the web site project. In all cases I set “Copy Local” to “true” to make it would be picked up upon publication.

Finally I build the site and then used “Publish…” to get the web site onto the server.

With these changes is just worked like a charm.

If at some point the server supports MVC 3 out of the box then certainly you will want to remove the MVC 3 related assemblies.

This solution may not be the right choice for your scenario. Check Scott’s post for other options that may work better for you.


Post a Comment

All comments, questions and other feedback is much appreciated. Thank you!