System.Tuple在多个程序集中定义 [英] System.Tuple defined in multiple assemblies

查看:536
本文介绍了System.Tuple在多个程序集中定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在Windows 8中安装VS 11.当我得到最新的VS 2010构建的解决方案,然后构建它,我得到这个错误(在VS 11):


预定义类型System.Tuple在全局别名中的多个程序集中定义
;使用'c:\Program文件中的定义
(x86)\参考
Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll'


我无法通过Google找到答案。我不知道全局别名是什么。



VS 11自动进行了一些更改,所以我取消了这些更改,重新编译,并得到相同的错误。



我不知道该怎么办。任何人知道如何解决这个错误?



编辑 - 这些是项目中目前存在的引用 b $ b

我尝试删除未使用的引用,但仍然出现错误。





编辑2 - ANSWER



这个 System.Tuple 在Raven程序集中与.NET 4.0 System.Tuple 。谢谢Christopher Currens在他的回答中解释这个问题。



解决方案

看起来Raven.Abstractions是一个.NET 3.5程序集,而不是.NET 4.0参考。如果您查看 RavenDB此处的源代码,您如果它被构建用于.NET 3.5,它将定义 Tuple< T,U> 类。



你必须在某个时候将你的项目从.NET 3.5更新到.NET 4.0,因为我也注意到你有一个System.Core的引用。在.NET 4中,System.Core默认是引用,因此您项目中的引用是多余的。



我的建议是找到您已引用的所有程序集您的项目,并将它们替换为.NET 4版本(如果可用)。我知道.NET有额外的兼容性,因为它允许两个版本的运行时在一个进程中同时加载,但我不能想象它不影响性能在一些级别,即使只有一点点。 .NET 4运行时在许多方面都是优越的,特别是大对象堆。我想我跑了一点。只需更新您可以到4.0的程序集,或将您的项目版本更改回3.5。


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):

The predefined type 'System.Tuple' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll'

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 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?

Edit - These are the references that currently exist in the project

I tried deleting references that weren't used but I still got the error.

Edit 2 - ANSWER

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.

解决方案

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.

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.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆