Nuget versioning issue with package restore
http://stackoverflow.com/questions/12035976/nuget-versioning-issue-with-package-restore
Restart VS as administrator, extension manager uninstall nuget. restart VS as administrator again, search for nuget and install.
Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0
http://stackoverflow.com/questions/11000506/could-not-load-file-or-assembly-system-web-webpages-razor-version-2-0-0-0
Getting ASP.NET MVC 3 working on DiscountASP.net
http://joel.net/getting-asp.net-mvc-3-working-on-discountasp.net
在web application中引用了另一個公共的project,裏面更新了MVC dll的版本,結果舊的solution就編譯通不過了
1.首先重新安裝nuget,解決了上面的錯誤
2.接著報錯說web application使用的system.web.mvc.dll版本為3.0.0.0,而引用的project裏面版本時3.0.0.1,不能比引用的project版本更舊
我嘗試在web application 加上3.0.0.1版本的dll,Specific Version設為False,結果發現其它dll跟它是有關聯的。
好吧,一個一個地加
System.Web.WebPages
System.Web.WebPages.Razor
System.Web.WebPages.Deployment
結果在這裡卡殼了,無論怎麼加,始終報錯
Could not load file or assembly 'System.Web.WebPages.Deployment‘
3.最後的終極方法是在web applicaion裏面重新安裝Microsoft.AspNet.Mvc,當拿到最新版本4.0.0.0時,終於圓滿了,只要比引用的project版本新,就沒有問題.
Open 'Package Manager Console' in Visual Studio
Uninstall-Package Microsoft.AspNet.Mvc
Install-Package Microsoft.AspNet.Mvc
4.還有個問題就是本地能夠build,運行也沒問題,但發佈到server上就出錯,在web.config上更改如下就可以了
Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Elmah.MVC issue
http://stackoverflow.com/questions/16797015/could-not-load-file-or-assembly-system-web-mvc-version-3-0-0-0-elmah-mvc-issu
To fix this i had to add a binding redirect to my Web.config file: (at the end of the file, just before the
</configuration>
tag)
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>