错误:在VS2012升级到MVC4 MVC5 [英] Error:Upgrade MVC4 to MVC5 in VS2012
问题描述
我收到以下错误升级我的项目从MVC4到MVC5后。我跟着<一个href=\"http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2\">How升级一个ASP.NET MVC 4和Web API项目到ASP.NET MVC 5和Web API 2
I am getting below error after upgrade my project from MVC4 to MVC5. I followed How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2
大会WebServices.WebApi.External,版本= 1.0.0.0,文化=中立,公钥=空'使用'System.Web.Http,版本5.0.0.0 =文化=中性公钥= 31bf3856ad364e35'具有更高的版本比引用的程序集System.Web.Http,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35'
如何解决这个问题?
Assembly 'WebServices.WebApi.External, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
How to solve this issue?
推荐答案
我也跟着该文章没有在启动时完全成功,但
I also follow that article without full success at start but
要解决这个简单创建新的Web MVC框架项目,并将其保存
然后打开web.config中,从意见,packages.config web.config文件,并在记事本中的.csproj
To fix this "simple" create new web mvc project and save it then open web.config, web.config from views, packages.config, and .csproj in notepad
然后打开您的项目,并期待在差异入境的文件版本号
例如在包中,你应该看到
then open your project and look at difference in entry for version numbers of files e.g. in packages you should see
<package id="Microsoft.AspNet.Mvc" version="5.0.0" targetFramework="net45" />
但你可以有
<package id="Microsoft.AspNet.Mvc" version="4.x.x.x" targetFramework="net40" />
在web.config中
in web.config
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
但你可以有
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
在.csproj的
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
但你可以有
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll</HintPath>
</Reference>
替换所有与新值
这是做按Ctrl + Shift + B后
在控制台的NuGet更新所有的包通过COMAND更新封装
after that do Ctrl+Shift+B and in nuget console update all packages by comand Update-Package
对于我这种工作终于
这篇关于错误:在VS2012升级到MVC4 MVC5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!