引用外部DLL时,无法编译,因为一些错误的元组C#项目 [英] Can't compile c# project because of some tuple error when referencing an external dll

查看:234
本文介绍了引用外部DLL时,无法编译,因为一些错误的元组C#项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个错误,当我尝试建立我的.NET 4,C#项目。一切都很正常,但是当我添加一个外部参考给定的DLL,它停止工作,就不能建立,抛出这种类型的一些错误的:

I have an error, when I try to build my .net 4, c# project. Everything works great, but when I add an external reference to a given DLL, it stops working, it can't build, throws this type of some errors:

36错误类型System.Tuple同时存在于C:\ Program Files文件\参考大会\微软\ Framework.NETFramework \ V4.0 \ mscorlib.dll中'和'C:\项目\ PROJECT1 \ ExternalRefernces \ SharpSNMP \ SharpSnmpLib.dll'C:\项目\ PROJECT1 \ CheckerStore.cs 17 21

Error 36 The type 'System.Tuple' exists in both 'C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll' and 'C:\Projects\Project1\ExternalRefernces\SharpSNMP\SharpSnmpLib.dll' C:\Projects\Project1\CheckerStore.cs 17 21

请注意,我并​​没有新的库,只是增加了作为参考做任何事情。任何想法?

Note, I did not do anything with the new library, just added as a reference. Any ideas?

推荐答案

什么,你所能做的就是改变目标版本3.5或使在SharpSNMPLib一些变化。源可以从这里或获取的这里

What you can do is either change the target version to 3.5 or make some changes in the SharpSNMPLib. The source can be fetched from here or here.

您需要做特别的运动型System.Tuple其他地方的变化。

The changes you need to make is specifically moving the System.Tuple type somewhere else.

编辑:
我相信你已经添加的引用precomplied DLL。这不是编译框架版本4,你需要做的DLL是下载源$ C ​​$ C(见上面的链接),并编译目标版本4的项目。


I belive you have added a reference to a precomplied DLL. A DLL that is NOT compiled for framework version 4. What you need to do is download the source code (see links above) and compile the project with target version 4.

为什么你需要做的,这是因为有根据框架的目标版本有条件的构建参数。所述SharpSNMPLib System.Tuple用于版本&所述; = 3.5和框架System.Tuple用于版本> = 4

Why you need to do this is because there are conditional build parameters depending on the framework target version. The SharpSNMPLib System.Tuple is used for version <= 3.5 and the framework System.Tuple is used for version >= 4.

编辑:

    使用框架System.Tuple和SharpSNMPLib.dll
  • 转载您的问题。

  • Reproduced your problem using framework System.Tuple and SharpSNMPLib.dll.

成功构建SharpSNMPLib针对性的4版本。

Successfully built SharpSNMPLib targeted on version 4.

使用框架System.Tuple和新SharpSNMPLib.dll成功地构建应用程序。

Successfully built application using framework System.Tuple and the new SharpSNMPLib.dll.

这篇关于引用外部DLL时,无法编译,因为一些错误的元组C#项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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