title: MVC4 Azure Publishing Error - Could not load file or assembly 'System.Web.Razor'
body: <p>The project runs fine locally, its only when published I get the following error:</p>
  
  <blockquote>
    <p>Could not load file or assembly 'System.Web.Razor' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)</p>
  </blockquote>
  
  <p>Having spent the last few hours googling the problem seems to be that a nuget package I added to the project references razor 1 and overwrote my razor 2 dll. I've tried copying the razor 2.0.0.0 dll into refernces instead of 1 but the error persists. This is where the conflict is shown in the detailed build output:</p>
  
  <pre class="lang-none prettyprint-override"><code>There was a conflict between "System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
  1&gt;      "System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
  1&gt;      References which depend on "System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll].
  1&gt;          C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll
  1&gt;            Project file item includes which caused reference "C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Razor.dll".
  1&gt;              System.Web.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
  1&gt;      References which depend on "System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Users\Jack\SkyDrive\LessonUp.Current\packages\RazorEngine.3.0.8\lib\net40\System.Web.Razor.dll].
  1&gt;          C:\Users\Jack\SkyDrive\LessonUp.Current\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll
  1&gt;            Project file item includes which caused reference "C:\Users\Jack\SkyDrive\LessonUp.Current\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll".
  1&gt;              System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL 
  1&gt;              Recaptcha
  </code></pre>
  
  <hr>
  
  <p>From there it continues to list other packages depending on razor 2.</p>
  
  <p>The packages I added to the project were: Recaptcha, Recaptcha.mvcModel and Postal.<br>
  Does anyone have an idea what steps I can take to resolve this?<br>
  Let me know if there is any more information I can give that might lead to a solution.</p>