I\'ve had this problem before, but then all i needed to do was to clean and rebuild the project. Now that doesnt seem to work anymore. When i start my Asp.Net MVC3 project d
Go to menu: "Tools / Nuget Package Manager / Package Manager Console"
run command install-package Microsoft.AspNet.WebPages
I scratched my head for a while over this problem when I had it. Eventually I noticed that I had the following section in the "runtime" section of my web.config.
<runtime>
. . .
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
. . .
</runtime>
As you can see, this refers to version 2 of the assembly, which doesn't match the following code that you also have in the system.web/compilation/assemblies section of web.config.
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
The actual assembly referenced in References for the project is indeed v1.0.0.0, so I changed the first chunk of code above to the following, which fixed the problem immediately. I'm not sure how the mistake got there in the first place.
<runtime>
. . .
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
</dependentAssembly>
. . .
</runtime>
I had this issue, all I had to do was change the property of the external reference: Specific Version from True to False
After that the project build again.
Worked for me:
Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution
Browse
Search for "Microsoft.AspNet.WebPages"
Make sure all projects in solution have the latest version.
I had this problem. Maybe it occurred when I installed .NET MVC v4 over the top of MVC v3, not sure.
Anyway I removed the System.Web.WebPages
reference from my project. Then in the Add Reference dialogue .NET tab there were two System.Web.WebPages references listed, a version 1.0.0.0 and a 2.0.0.0. I made sure to add the version 1.0.0.0 one as that was the one that was missing.
The solution for me was to go to my server and install the Web Pages Version 2 on the server.
Go to http://www.microsoft.com/en-us/download/details.aspx?id=34600
And download the package and run it.
It was as simple as that.