Since you have installed ASP.NET MVC 3 on your development machine you have all these MVC 3 assemblies installed in your GAC. Your production machine does not!
So you need to find this file and make it bin deployable however this cheeky assembly isn't in you solution so how can you do that? Well... add it. Go to Add Reference on your root web project (e.g. Web.csproj) and find System.Web.WebPages.Razor and add.
Now right click this assembly in your references directory and click properties.
Now you can make it bin deployable by setting Copy Local to true like so:
Note this is how to deploy the System.Web.WebPages.Razor assembly withe your ASP.NET MVC 3 web application. To deploy a typical setup of an ASP.NET MVC 3 app you will need to do the same for all of the following assemblies:
- System.Web.Mvc
- System.Web.Helpers
- System.Web.Razor
- System.Web.WebPages
- System.Web.WebPages.Deployment
- System.Web.WebPages.Razor as detailed above
- Microsoft.Web.Infrastructure this will also need a reference added as above
- WebMatrix.Data this also needs the reference
Of course you only need to add the reference to these assemblies if they are not already there - in most cases it will be. This was mainly a blog post for the slightly more complicated System.Web.WebPages.Razor.dll






Thanks for this. Saved my team lots of time.
ReplyDeleteThat's what I like to hear!
ReplyDeleteThanks! You got us fixed right up!!!!
ReplyDeleteThanks for this. Saved me lots of time!! I mean it!
ReplyDeleteWowwww... Perfect.. After 2 days reading heaps of blogs finally your blog solved my problem!! ;)
ReplyDeleteYou forget about "NuGet.Core" (you may notice in your other post http://www.britishdeveloper.co.uk/2011/06/adding-mvc-dependencies-to-project-for.html - screenshot with this reference)
ReplyDeleteWell, at least Azure force me to use it :)
Thank you very much btw
What worked for me was to right-click on the project and select Add Deployable Dependancies
ReplyDeletethank you for your advise, it helped me!
DeleteYes you can and it is much easier and works well (if you are publishing using Web Deploy). I wrote this post before SP1 had come out though (hence the update at the end of the post).
ReplyDeleteI,m sorry, i.m a newbie in c# mvc3, i want to ask u, how to deploy my app in IIS7, what first I should do and What next? i need ur help, cz its urgently need...
ReplyDeleteIf it is so urgent, why is 'a newbie' in charge? Anyway, sorry I haven't got the time to train you to do the job you don't deserve but I have found a link that should help: http://www.lmgtfy.com/?q=deploy+mvc3+to+iis7
ReplyDeletethanks, helpful
ReplyDeleteThank you, very helpful
ReplyDeleteYou Rock!!!!!
ReplyDeleteThanks Man! It help me to publish an application in a sub-domain.
ReplyDelete