the schema version of 'microsoft.aspnet.mvc' is incompatible with version of nuget

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>

 

posted on   白马酒凉  阅读(128)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示