473,756 Members | 5,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

conflicting namespace problem

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\BorderS trip.resx". MyUserControl2
anyone have any suggestions?
Jan 2 '06 #1
11 3917
"alex sparsky" <al**@sparkysys tems.com> wrote in message
news:2d******** *************** *********@4ax.c om...
anyone have any suggestions?
Update them to use the same version?

Jan 3 '06 #2
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**@sparkysys tems.com> wrote in message
news:2d******** *************** *********@4ax.c om...
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\BorderS trip.resx". MyUserControl2
anyone have any suggestions?

Jan 4 '06 #3
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.


Jan 5 '06 #4
Alex,

I don't think there is a general solution to your problem.
If your controls use the common library internaly without exposing publicly
any type from the common library outside everything will work OK. If the
main code tries to instantiate any of the files in the library there is a
problem and this problem can only be solved in c# 2.0 using extern aliase,
but this should be taken care of the programmer using the controls and even
then it might be not that easy to use.

The only solution I can see is to use the same version for all your
controls.
--

Stoitcho Goutsev (100)
"alex sparsky" <al**@sparkysys tems.com> wrote in message
news:gt******** *************** *********@4ax.c om...
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.

Jan 5 '06 #5
"alex sparsky" <al**@sparkysys tems.com> wrote in message
news:gt******** *************** *********@4ax.c om...
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.


You didn't answer my question. Why not update the controls to use the same
common library?

Michael
Jan 8 '06 #6
Michael,

I don't know what the Alex's problem actually is, but I can see where this
can happen and updating control's is not possible. Imagine that I'm
manufacturer of the common library. I sell this library to other companies
and have released couple of versions. Other companies are using my library
to in their own controls. Company A uses version 5 but company B has
released their control using version 2 and doesn't want to upgrade for some
reason. A customer buy controls from Company A and Company B and he/she
cannot use them because of conflicting namespaces.

I don't see easy solution for this. If the common library is build fully
bacword compatible the consumer of the controls can redirect the versions of
the common library to use the latest one, but if the library is not backword
compatible the only solution that I see is to use external aliases.

--

Stoitcho Goutsev (100)
"Michael C" <mc*****@NOSPAM optushome.com.a u> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
"alex sparsky" <al**@sparkysys tems.com> wrote in message
news:gt******** *************** *********@4ax.c om...
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.


You didn't answer my question. Why not update the controls to use the same
common library?

Michael

Jan 9 '06 #7
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Michael,

I don't know what the Alex's problem actually is, but I can see where this
can happen and updating control's is not possible. Imagine that I'm
manufacturer of the common library. I sell this library to other companies
and have released couple of versions. Other companies are using my library
to in their own controls. Company A uses version 5 but company B has
released their control using version 2 and doesn't want to upgrade for
some reason. A customer buy controls from Company A and Company B and
he/she cannot use them because of conflicting namespaces.


But in that case the controls would be in different dirs so there'd be no
problem. The same company would need to ship both versions for there to be a
problem.

Michael
Jan 9 '06 #8
Why they are going to be in different dirs? If they are in the GAC - Yesm
but if they are privately deployed they might be in the same dir.
Even in different dirs there are going to be a problem if the client of the
control tries to use a type decalred in the common library (e.g. declare a
variable of a type form the custom library) Because there are two versions
of types with exactly the same name (including the namespace) the compiler
cannot pick one of them and will report ambiguity.
--

Stoitcho Goutsev (100)

"Michael C" <mc*****@NOSPAM optushome.com.a u> wrote in message
news:ue******** ******@TK2MSFTN GP10.phx.gbl...
"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Michael,

I don't know what the Alex's problem actually is, but I can see where
this can happen and updating control's is not possible. Imagine that I'm
manufacturer of the common library. I sell this library to other
companies and have released couple of versions. Other companies are using
my library to in their own controls. Company A uses version 5 but company
B has released their control using version 2 and doesn't want to upgrade
for some reason. A customer buy controls from Company A and Company B and
he/she cannot use them because of conflicting namespaces.


But in that case the controls would be in different dirs so there'd be no
problem. The same company would need to ship both versions for there to be
a problem.

Michael

Jan 10 '06 #9
this is a very astute observation. That is a very close example to
what the reality is. The dll's are usually in the same directory and
included into the same project. Those who are using an older version
of a given library and don't want to upgrade every control will have
the namespace conflict.

On Mon, 9 Jan 2006 09:23:37 -0500, "Stoitcho Goutsev \(100\)"
<10*@100.com> wrote:
Michael,

I don't know what the Alex's problem actually is, but I can see where this
can happen and updating control's is not possible. Imagine that I'm
manufacturer of the common library. I sell this library to other companies
and have released couple of versions. Other companies are using my library
to in their own controls. Company A uses version 5 but company B has
released their control using version 2 and doesn't want to upgrade for some
reason. A customer buy controls from Company A and Company B and he/she
cannot use them because of conflicting namespaces.

I don't see easy solution for this. If the common library is build fully
bacword compatible the consumer of the controls can redirect the versions of
the common library to use the latest one, but if the library is not backword
compatible the only solution that I see is to use external aliases.


Jan 18 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3990
by: humble04 | last post by:
Hi, I am compiling a collection of C++ code. Most of them are using the new format #include <iostream>. I think all of them because I failed at finding out which header file uses the old format #include <iostream.h>. However, I met the following error messages. "/usr/vacpp/include/iostream.h", line 74.7: 1540-0400 (S) "class ostream" has a conflicting declaration "../include/myfile.h", line 7.1: 1540-0424 (I) "ostream" is declared on
6
8116
by: user | last post by:
Hi, I got this error and donno know how to fix it: In file included from ../except.h:53, from group.c:22: .../portspecs.h:81: error: conflicting types for `const double __infinity' /usr/include/math.h:26: error: previous declaration as `const __dmath __infinity'
7
2620
by: Thiru | last post by:
I am writing an application that interacts with Oracle and Teradata. In order to create the executable, I need to link various Oracle and Teradata libraries. I found out that when I link the Oracle and Teradata libraries together, the Teradata API functions are not working properly. My assumption is that these libraries are sharing identical function names and parameter lists and hence the conflicts are causing the problem. Is my...
4
1988
by: Alexander Gorshenev | last post by:
I am looking for an elegant solution for the following problem: I have two projects for which I have to create a kind of bridge or translator between. For each of the projects there exist a set of headers included by practicaly all of the member .c files. For my bridge I would be using all those "main" headers from both of the projects included together. But unfortunately, due to historical reasons, those headers conflict in many...
8
9308
by: Lathe_Biosas | last post by:
Hi While compiling my application that needs "windows.h" there are some typedef redefinition errors redefinition at winnt.h( line 207) typedef void *HANDLE redefinition at windef.h( line 143) typedef unsigned char BYTE redefinition at windef.h( line 141) typedef unsigned long DWORD #define INVALID_HANDLE_VALUE -1 redefinition at winbase.h(55) #define
2
1838
by: Will | last post by:
I've included both the System.Drawing namespance and the System.Web.UI.WebControls namespace on my page. Both of these have an Image class, so when I call the Image class (refering to the System.Drawing namespace) can I do it without having to write the entire string? System.Drawing.Image... I get errors saying Image is ambiguous otherwise.
19
1634
by: dickinsm | last post by:
Here's an example of a problem that I've recently come up against for the umpteenth time. It's not difficult to solve, but my previous solutions have never seemed quite right, so I'm writing to ask whether others have encountered this problem, and if so what solutions they've come up with. Suppose you're writing a class "Rational" for rational numbers. The __init__ function of such a class has two quite different roles to play. ...
1
1928
by: helraizer1 | last post by:
Hi folks, I have an image based shoutbox which I am currently implementing emoticons onto. I have a way now for the emoticons to appear where the :D or =) etc. is on the image, but for some reason they seem to be conflicting. I shall try to explain. chatbox.php - only necessary code shown $grins = array('=D', "=d", ":d", ":D"); foreach ($grins as $grin) {
12
9134
by: Michael.Z | last post by:
Anyone who can help: Given a Table.h file I am writing a Table.c file. I keep getting the compile error: previous declaration of Table was here / conflicting types for I think the problem was the result of two pieces of code. First: typedef struct Table; /* in Table.c*/
0
9454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10028
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9868
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9707
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5139
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.