在多个程序集中定义的 System.Tuple [英] System.Tuple defined in multiple assemblies
问题描述
我刚刚在 Windows 8 中安装了 VS 11.当我获得使用 VS 2010 构建的最新解决方案时,然后构建它,我收到此错误(在 VS 11 中):
I just installed VS 11 within Windows 8. When I got the latest of a solution built with VS 2010, then built it, I'm getting this error (in VS 11):
预定义类型System.Tuple"在多个程序集中定义在全局别名中;使用来自 'c:Program Files 的定义(x86)参考程序集MicrosoftFramework.NETFrameworkv4.0mscorlib.dll'
The predefined type 'System.Tuple' is defined in multiple assemblies in the global alias; using definition from 'c:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0mscorlib.dll'
我无法通过 Google 找到答案.而且我不知道全局别名"是什么.这些词太笼统,无法通过 Google 搜索找到.
I haven't been able to find an answer via Google. And I don't know what the "global alias" is. Those words are too generic to find via a Google search.
VS 11 自动进行了一些更改,所以我取消了这些更改,重新编译,并得到了同样的错误.
VS 11 automatically made some changes, so I undid those, recompiled, and got the same error.
我不知道该怎么办.有谁知道如何解决这个错误?什么是全局别名?
I'm not sure what to do. Anyone know how to resolve this error? And what is the global alias?
编辑 - 这些是项目中当前存在的引用
我尝试删除未使用的引用,但仍然出现错误.
I tried deleting references that weren't used but I still got the error.
编辑 2 - 答案
这个 System.Tuple
,在 Raven 程序集中,与 .NET 4.0 System.Tuple
冲突.感谢 Christopher Currens 在他的回答中解释了这一点.
This System.Tuple
, within the Raven assembly, conflicts with the .NET 4.0 System.Tuple
. Thank you to Christopher Currens for explaining this in his answer.
推荐答案
看起来 Raven.Abstractions 是 .NET 3.5 程序集,而不是 .NET 4.0 参考.如果您查看源代码 此处为 RavenDB,如果它是为 .NET 3.5 构建的,你会注意到它定义了一个 Tuple
类.
It looks like Raven.Abstractions is a .NET 3.5 assembly, instead of a .NET 4.0 reference. If you look at the source code for RavenDB Here, you'll notice that it defines a Tuple<T, U>
class if it's being built for .NET 3.5.
您一定在某个时候将您的项目从 .NET 3.5 更新到了 .NET 4.0,因为我还注意到您引用了 System.Core.在 .NET 4 中,System.Core 是默认引用,因此项目中的引用是多余的.
You must have updated your project from .NET 3.5 to .NET 4.0 at some point, because I also notice you have a reference to System.Core. In .NET 4, System.Core is reference by default and so that reference in your project is redundant.
我的建议是您找到项目中已经引用的所有程序集,并将它们替换为 .NET 4 版本(如果可用).我知道 .NET 具有额外的兼容性,因为它允许在一个进程中同时加载两个版本的运行时,但我无法想象它不会在某种程度上影响性能/em>,即使只有一点点..NET 4 运行时在很多方面都更胜一筹,特别是大对象堆.我想我在咆哮一点.只需将您可以使用的程序集更新到 4.0,或者将您的项目版本更改回 3.5.
My suggestion is you find all assemblies that you are already referencing in your project and replace them with .NET 4 versions, if available. I know that .NET has that extra compatibility, in that it allows two versions of the runtime to be loaded in a process at the same time, but I can't imagine that it doesn't affect performance on some level, even if only a tiny bit. The .NET 4 runtime is superior in a lot of ways though, specifically the large object heap. I guess I'm ranting a little bit. Just update what assemblies you can to 4.0, or change your project's version back down to 3.5.
这篇关于在多个程序集中定义的 System.Tuple的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!