[英]MVC version mismatch with NuGet in Visual Studio 2010 on XP
I went to do this tutorial: http://mono.servicestack.net/ServiceStack.Hello/ 我去做这个教程: http : //mono.servicestack.net/ServiceStack.Hello/
I am running on XP, SP3, Visual Studio 2010, SP1. 我在XP,SP3,Visual Studio 2010,SP1上运行。 The first PM downloaded, built, ran.
下载,构建并运行了第一台PM。 In the package manager:
在包管理器中:
PM> Install-Package ServiceStack.Host.AspNet
The second PM downloaded just fine: 第二个PM下载就好了:
Install-Package ServiceStack.Host.Mvc
The error was that there was no reference for: 错误是没有针对以下内容的参考:
using System.Web.Mvc;
So I added a reference to my version of System.Web.Mvc, and then got this error: 所以我添加了对我的System.Web.Mvc版本的引用,然后收到此错误:
Error 1 Assembly 'ServiceStack.Mvc, Version=4.0.11.0, Culture=neutral,
PublicKeyToken=null' uses 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly
'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
c:\Documents and Settings\daniel.SUN\My Documents\Visual Studio 2010\Projects\RestTestApi
\packages\ServiceStack.Mvc.4.0.11\lib\net40\ServiceStack.Mvc.dll RestTestApi
Clearly I have a version mismatch in .Net and MVC but I'm not sure how to navigate through to resolving this. 显然,.Net和MVC中的版本不匹配,但是我不确定如何导航以解决此问题。 I have a kind of old system, XP SP3.
我有一种旧系统XP SP3。 I put .NET 4.0, which I checked was compatible with this OS.
我放了.NET 4.0,我检查了它是否与此操作系统兼容。 But I have older versions of .NET as well that I never uninstalled.
但是我也有从未卸载过的.NET较旧版本。 The question is what should be installed for this error to be resolved?
问题是应该安装什么才能解决此错误? I installed MVC 4 and then it built, but didn't run.
我安装了MVC 4,然后构建了它,但没有运行。 Here is a list from "Add or Remove Programs":
这是“添加或删除程序”中的列表:
Microsoft .NET Framework 2.0 Service Pack 2
Microsoft .NET Framework 3.0 Service Pack 2
Microsoft .NET Framework 3.5 SP1
Microsoft .NET Framework 4 Client Profile
Microsoft .NET Framework 4 Extended
Microsoft .NET Framework 4 Multi-Targeting Pack
Microsoft ASP.NET MVC 2
Microsoft ASP.NET MVC 2 - Visual Studio 2010 tools
Microsoft ASP.NET MVC 4
Microsoft ASP.NET Web Pages 2
The failure on run was in the browser upon running: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 运行失败是由于浏览器正在运行:无法加载文件或程序集'System.Web.Mvc,版本= 3.0.0.0,文化=中性,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The system cannot find the file specified.
该系统找不到指定的文件。 Description: An unhandled exception occurred during the execution of the current web request.
说明:执行当前Web请求期间发生未处理的异常。 Please review the stack trace for more information about the error and where it originated in the code.
请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 异常详细信息:System.IO.FileNotFoundException:无法加载文件或程序集'System.Web.Mvc,版本= 3.0.0.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The system cannot find the file specified.
该系统找不到指定的文件。
I then tried to install MVC 3, but it would not, giving some error about NuGet being a newer version. 然后,我尝试安装MVC 3,但没有安装,并给出了有关NuGet是较新版本的一些错误。 So it all comes back to the right set of versions?
一切都回到正确的版本集了吗?
I solved this by uninstalling MVC4 and installing MVC3. 我通过卸载MVC4并安装MVC3来解决了这一问题。 For some reason I thought with .NET 4.0 that I should use MVC4, as though they were a pair.
由于某种原因,我认为在.NET 4.0中应该使用MVC4,就像它们是一对一样。 It looks like that thinking was wrong.
看来这种想法是错误的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.