I really do not know what to do, I\'m following this article that shows how to migrate my MVC 3 application manually .
I followed all the steps but
I assumed you have MVC3 Intranet web application, when upgrade from MVC3 to MVC4 using NuGet, your application now references System.Web.WebPages.Razor Version 2.0.0.0, NOT System.Web.WebPages.Razor Version 1.0.0.0 anymore. Here is my way of resolving the reference.
There are two places to fix:
In the root web.config,
<compilation debug="true" targetFramework="4.0">
<assemblies>
. . .
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
. . .
</assemblies>
</compilation>
change Version=1.0.0.0 to Version=2.0.0.0
So your new reference will look like this:
<compilation debug="true" targetFramework="4.0">
<assemblies>
. . .
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
. . .
</assemblies>
</compilation>
Hope it helps!
Have you globally searched for System.Web.WebPages.Razor, Version=1.0.0.0 in your entire solution? Do you still reference System.Web.WebPages.Razor
(Version 1.0.0.0)? Do you reference System.Web.WebPages.Razor
Version 2.0.0.0?
[Update] I finally ran into the same issue. It seems like one of the NuGet packages I installed and uninstalled didn't entirely remove the reference to System.Web.Razor
it used. Cleaning the solution didn't help because the DLL wasn't used directly by the web application. I finally got it to work by manually deleting the entire bin directory ...
this is very simple, when you update to MVC 4.0.0.0 ,but the webconfig in the solution still points to MVC 3.0.0.0.0. so just replace MVC version 3.0.0.0.0. by 4.0.0.0.0
Do the same with other assemblies, to check the version of assembly , check properties of the respective assembly in references in your project.
This is another Nuget package that u can use to upgrade mvc 3 to mvc 4 https://nuget.org/packages/UpgradeMvc3ToMvc4
My application used a third-party package, the AspNetSprites-MvcAndRazorHelper. Reinstalled this package and the error of the reference was corrected.
Did you forget to update the references in Views\Web.Config
? The references in it is used to build the view pages.