Could not load file or assembly 'System.Web.Razor' or one of its dependencies

Quite a few ways to fix this:

  1. Install MVC on the web server (which is not always possible).

  2. In visual studio you can set dlls to copy to local on build, see the following article (please note MVC dlls have changed names slightly but it gives you the process) http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx

  3. Copy the appropriate dlls from your GAC into the bin folder of the umbraco site. To do this open "%windir%\Microsoft.NET\assembly\GAC_MSIL" in explorer and you will find all of the dlls installed in the GAC and you can copy the appropriate versions into your project. This is similar to the above method but bypasses building the project.

In terms of files you will likely need more than just System.Web.Razor.dll however this will work for all of the missing files.


Reinstall package Microsoft.AspNet.Razor, like ADreNaLiNe-DJ posted. The best way to do this is using Update-Package command, because The Install-Package command does not provide an option to force a reinstall, see docs.

PM> Update-Package Microsoft.AspNet.Razor -reinstall