C#编译器警告1685 [英] C# Compiler Warning 1685

查看:458
本文介绍了C#编译器警告1685的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,(貌似)出蓝色的,我的项目开始得到编译器警告1685:

So, (seemingly) out of the blue, my project starts getting compiler warning 1685:

在predefined型   System.Runtime.CompilerServices.ExtensionAttribute   在多个组件定义   全球别名;使用定义   从C:\ Program Files文件\参考   大会\微软\框架\器v3.5 \ System.Core.dll的

The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll'

不惑,我研究的MSDN文章要弄清楚它的原因。下面是我查到的资料:

Perplexed, I researched the MSDN article to figure out its cause. Here's the information I found:

的Visual C#参考:错误和   警告编译器警告(等级1)   CS1685

Visual C# Reference: Errors and Warnings Compiler Warning (level 1) CS1685

错误消息的predefined型   '的System.Type名称'中定义   在全球多个程序集   别名;从文件使用的定义   名称

Error Message The predefined type 'System.type name' is defined in multiple assemblies in the global alias; using definition from 'File Name'

在predefined出现此错误   系统类型如System.Int32的是   在两个组件中。一种方式这   可能出现的情况是,如果你正在引用   mscorlib程序从两个不同的地方,   如试图运行the.Net   框架1.0和1.1版   并排。

This error occurs when a predefined system type such as System.int32 is found in two assemblies. One way this can happen is if you are referencing mscorlib from two different places, such as trying to run the.Net Framework versions 1.0 and 1.1 side-by-side.

编译器将使用的定义   从只有一个组件。该   编译器搜索全球唯一的别名​​,   不搜索定义的库   /参考。如果您指定   包括/ nostdlib,编译器将搜索   为对象,并在将来的起始   所有搜索$ P $的pdefined类型   在那里找到对象的文件。

The compiler will use the definition from only one of the assemblies. The compiler searches only global aliases, does not search libraries defined /reference. If you have specified /nostdlib, the compiler will search for Object, and in the future start all searches for predefined types in the file where it found Object.

现在我真的抓我的头。

Now I'm really scratching my head.

  1. 我不是运行两个不同的 .NET Framework的版本 (除非你算上2.0和3.5)。

  1. I'm not running two different versions of the .NET Framework (unless you count 2.0 and 3.5).

我不引用任何怪异 集会可能使我 可疑的。

I'm not referencing any bizarre assemblies that might make me suspicious.

我不记得做任何改变我的应用程序,它会刺激这种变化。

I don't recall making any changes to my application that would spur this change.

我已经验证所有组件面向.NET Framework版本V2.0.50727。

I've verified that all components target .NET Framework version v2.0.50727.

我接受建议,或就如何纠正这方面的意见。我警告视为错误,并且它的驾驶我疯了。

I'm open to suggestions, or ideas on how to correct this. I treat warnings as errors, and it's driving me crazy.

真正的错误我,那就是我不知道的为什么的它的发生。事情发生应该有一个有迹可寻的事业,我应该知道他们为什么发生。如果我无法解释它,我不能准确地解决它。猜测是从来没有令人满意的。

What really bugs me about it is that I don't know why it's occurring. Things that happen should have a discernable cause, and I should know why they happened. If I can't explain it, I can't accurately remedy it. Guesswork is never satisfactory.

应用程序很简单,由一个类库,和Windows窗体应用程序。

The application is straightforward, consisting of a class library, and a windows forms application.

  • C#类库的DLL提供的基本功能封装数据库访问。该DLL引用以下组件:

  • A C# class library DLL providing basic functionality encapsulating database access. This DLL references the following components:

  • 系统
  • System.Core程序
  • System.Core.Data
  • System.Data这
  • System.Data.DataSetExtensions
  • System.Data.OracleClient的
  • 在System.Drawing中
  • System.Windows.Forms的
  • 的System.Xml
  • System.Xml.Linq的
  • System
  • System.Core
  • System.Core.Data
  • System.Data
  • System.Data.DataSetExtensions
  • System.Data.OracleClient
  • System.Drawing
  • System.Windows.Forms
  • System.Xml
  • System.Xml.Linq

C#Windows窗体应用程序提供用户界面。本申请引用以下组件:

A C# Windows Forms application providing the UI. This application references the following components:

  • 清洁code
  • 清洁codeControls(这两种提供语法编辑器支持,并在当地建立在.NET 3.5)。
  • LinqBridge
  • Roswell.Framework(类库以上)
  • 系统
  • System.Core程序
  • System.Data这
  • System.Data.DataSetExtensions
  • System.Data.OracleClient的
  • System.Deployment
  • System.Design
  • 在System.Drawing中
  • System.Windows.Forms的
  • 的System.Xml
  • System.Xml.Linq的
  • CleanCode
  • CleanCodeControls (both of these provide syntax editor support, and are locally built against .NET 3.5).
  • LinqBridge
  • Roswell.Framework (the class library above)
  • System
  • System.Core
  • System.Data
  • System.Data.DataSetExtensions
  • System.Data.OracleClient
  • System.Deployment
  • System.Design
  • System.Drawing
  • System.Windows.Forms
  • System.Xml
  • System.Xml.Linq

让我知道如果你需要进一步的信息,我会很乐意提供。

Let me know if you need further information and I'll gladly provide it.

在此先感谢。

推荐答案

LINQBridge让我立刻怀疑。这样做的整个目的是提供扩展属性/方法等等为2.0的用户。如果你有3.5(System.Core.dll的),不要使用LINQBridge。如果你的执行的需要LINQBridge 3.5一些模糊的原因(我想不出一个),那么你可能需要使用一个外部别名。但我的真的怀疑你需要它!

LINQBridge makes me immediately suspicious. The entire intent of this is to provide extension attribute/methods etc for 2.0 users. If you have 3.5 (System.Core.dll), don't use LINQBridge. If you do need LINQBridge in 3.5 for some obscure reason (and I can't think of one), then you might have to use an extern alias. But I really doubt you need it!

这篇关于C#编译器警告1685的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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