冲突的命名空间问题 [英] conflicting namespace problem

查看:62
本文介绍了冲突的命名空间问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当独特的问题,我需要一些建议。


我有多个c#控件需要使用常见的

命名空间。因此,当我包含两个使用

的控件时,通用命名空间和一个控件具有较新版本的那个

命名空间时,编译器会抱怨含糊不清的引用。 br />

我已经尝试使用编译器指令来操作命名空间,以便在编译时使用不同的
但是vs.net 2005一直让我感到悲伤

对他们说


警告2在文件BorderStrip.cs中的

条件编译指令中找到了名称空间或类定义;。这个

可能导致对

资源Common \BorderStrip.resx的清单资源名称选择错误。 MyUserControl2

有人有什么建议吗?

解决方案

" alex sparsky" <人** @ sparkysystems.com>在消息中写道

新闻:2d ******************************** @ 4ax.com ...

有人有什么建议吗?


更新它们以使用相同的版本?



Alex,


我坦率地说我不太了解这个问题,但我建议使用

别名(在* using *指令或C#
2.0新功能 - extern别名 - 如果你想引用同一个库的不同

版本。


你得到的警告使用条件编译时

是因为编译器使用它看到的第一个命名空间,即

条件指令,将表单资源放入。

-


Stoitcho Goutsev(100)

" alex sparsky"< al ** @ sparkysystems.com>写道:消息

新闻:2d ******************************** @ 4ax.com .. 。

我有一个相当独特的问题,我需要一些建议。

我有多个需要的c#控件o使用通用的命名空间。因此,当我去包含两个使用通用命名空间的控件和一个控件具有该命名空间的更新版本的控件时,编译器会抱怨含糊不清的引用。

我'尝试使用编译器指令来操作命名空间,以便在编译时有所不同,但vs.net 2005一直让我感到悲伤

警告2命名空间或类定义在文件BorderStrip.cs中的条件编译指令中找到。这可能导致对
资源Common \ BorderStrip.resx的清单资源名称选择不正确。 MyUserControl2

有人有什么建议吗?



问题是我有多个控件使用了共同图书馆。如果人们在项目中拥有多个控件,那么他们将获得多个idential命名空间。更糟糕的是,这些命名空间中的代码可能会略有不同,具体取决于它的版本。


On Wed,2006年1月4日10:56:00 -0500,Stoitcho Goutsev \(100 \)[C#MVP]" < 10*@100.com>写道:

Alex,

坦率地说,我不太了解这个问题,但我建议使用
别名(给出名称空间不同的名称在* using *指令或C#
2.0新功能 - extern别名 - 如果你想引用同一个库的不同版本。

警告你在使用条件编译时获取
是因为编译器使用它看到的第一个命名空间,即
条件指令,将表单资源放入。




I have a rather unique problem that I need some advice on.

I have multiple c# controls that need to make use of a common
namespace. So when I go to include both controls that make use of
that common namespace and one control has a newer version of that
namespace, the compiler complains about ambiguous references.

I''ve tried using compiler directives to manipulate the namespaces to
be different at compile time but vs.net 2005 keeps giving me grief
over them saying that

Warning 2 A namespace or class definition was found within a
conditional compilation directive in the file "BorderStrip.cs". This
may lead to an incorrect choice for the manifest resource name for
resource "Common\BorderStrip.resx". MyUserControl2
anyone have any suggestions?

解决方案

"alex sparsky" <al**@sparkysystems.com> wrote in message
news:2d********************************@4ax.com...

anyone have any suggestions?
Update them to use the same version?



Alex,

Frankly I don''t understand the problem very well, but I''d suggest using
aliases (giving namespaces different names at the *using* directive or C#
2.0 new feature - extern aliase - if you want to reference different
versions of the same library.

The warning that you get when using conditional compilation
is because the compiler uses the first namespace it sees, regardles of the
conditional directives, to place the form resource in.
--

Stoitcho Goutsev (100)

"alex sparsky" <al**@sparkysystems.com> wrote in message
news:2d********************************@4ax.com...

I have a rather unique problem that I need some advice on.

I have multiple c# controls that need to make use of a common
namespace. So when I go to include both controls that make use of
that common namespace and one control has a newer version of that
namespace, the compiler complains about ambiguous references.

I''ve tried using compiler directives to manipulate the namespaces to
be different at compile time but vs.net 2005 keeps giving me grief
over them saying that

Warning 2 A namespace or class definition was found within a
conditional compilation directive in the file "BorderStrip.cs". This
may lead to an incorrect choice for the manifest resource name for
resource "Common\BorderStrip.resx". MyUserControl2
anyone have any suggestions?



the problem is that I have more than one control that uses a common library. If people have more than one of my controls in a project then they will get more than one idential namespace. Worse yet, the code in those namespaces may be slightly
different based on which version it is.

On Wed, 4 Jan 2006 10:56:00 -0500, "Stoitcho Goutsev \(100\) [C# MVP]" <10*@100.com> wrote:

Alex,

Frankly I don''t understand the problem very well, but I''d suggest using
aliases (giving namespaces different names at the *using* directive or C#
2.0 new feature - extern aliase - if you want to reference different
versions of the same library.

The warning that you get when using conditional compilation
is because the compiler uses the first namespace it sees, regardles of the
conditional directives, to place the form resource in.




这篇关于冲突的命名空间问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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