473,800 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Aliasing duplicated namespaces in seperate dll's

I have two assemblies with a different implementation of the same class Lets
say ns1 and ns1 with the class Widget.

I add the references to the project and put in aliases in each of the
properties for the libraries as w1 and w2 and before my using imports, I
put

extern alias w1;
extern alias w2;

Its fine until I try to compille and then I get the error.

cannot reference directories. Can someone tell me where Im going wrong here.

Thanks
Jun 27 '08 #1
2 1608
On Apr 27, 1:17*pm, "OHM \( One Handed Man \)" <m...@myplace.c om>
wrote:
I have two assemblies with a different implementation of the same class Lets
say *ns1 and ns1 with the class *Widget.

I add the references to the project and put in aliases in each of the
properties for the libraries as w1 and w2 *and before my using imports, I
put

extern alias w1;
extern alias w2;

Its fine until I try to compille and then I get the error.

cannot reference directories. Can someone tell me where Im going wrong here.

Thanks
If you're wanting to alias namespaces then do the following.

using MyNamespace1 = w1;
using MyNamespace2 = w2;

Is that what you're looking for? Or are you saying that the classes
just happen to have the same namespace path? If they do then you'll
have to tell the compiler you want to alias the assemblies before you
can use the extern alias statement. See the following link.

<http://msdn2.microsoft .com/en-us/library/ms173212(VS.80) .aspx>
Jun 27 '08 #2
>Is that what you're looking for? Or are you saying that the classes
>just happen to have the same namespace path? If they do then you'll
have to tell the compiler you want to alias the assemblies before you
can use the extern alias statement. See the following link.
yes, the same fully qualified namespace in two different assemblies. I added
the aliases by selecting the properties of the dll'S AND filling in w1 and
w2 respectively before using the extern keyword. However it results in the
error message I explained, perhaps what I did was incorrect. ?

Cheers

"Brian Gideon" <br*********@ya hoo.comwrote in message
news:e5******** *************** ***********@m3g 2000hsc.googleg roups.com...
On Apr 27, 1:17 pm, "OHM \( One Handed Man \)" <m...@myplace.c om>
wrote:
I have two assemblies with a different implementation of the same class
Lets
say ns1 and ns1 with the class Widget.

I add the references to the project and put in aliases in each of the
properties for the libraries as w1 and w2 and before my using imports, I
put

extern alias w1;
extern alias w2;

Its fine until I try to compille and then I get the error.

cannot reference directories. Can someone tell me where Im going wrong
here.

Thanks
If you're wanting to alias namespaces then do the following.

using MyNamespace1 = w1;
using MyNamespace2 = w2;

Is that what you're looking for? Or are you saying that the classes
just happen to have the same namespace path? If they do then you'll
have to tell the compiler you want to alias the assemblies before you
can use the extern alias statement. See the following link.

<http://msdn2.microsoft .com/en-us/library/ms173212(VS.80) .aspx>
Jun 27 '08 #3

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

Similar topics

5
1298
by: EMonaco | last post by:
All, I have a simple C# window app under MyApp namespace it has a class Form1. I've added another class .cs file. Now this class I want to share with many projects, so I figured I'd change this class.cs file from namespace MyApp Class MyClass
3
2323
by: Jim Heavey | last post by:
Trying to get the hang of Namespaces. I have primarly developed in VB and am transitioning to C# and the .Net Environment. I have worked a bit with Java as well in school about a year or so ago. NameSpaces and Java Packages are similar in nature? In the dot net world, you are not able to pick out (import) a particulare "class" within the namespace - just the entire namespace. Is that Right? In Java, I would carve out a place on my...
1
1452
by: dhnriverside | last post by:
Hi peeps I want to create some namespaces and dlls to encapsulate some common functionality. Here's what I want. Me Me.CompanyA Me.CompanyA.BusinessObjects Me.CompanyB. Me.CompanyB.BusinessObjects
5
8543
by: geoffblanduk_nospam | last post by:
Is it valid to share namespaces across projects in C#? For example, I have a project that contains the code for a core assembly, this builds a DLL. I then have a second project in the same solution that contains test cases for the assembly in the same namespace, this references the first project's DLL and builds a further DLL for testing. All code has the same namespace. The code in the tests needs access to internal methods etc of the...
17
2078
by: clintonG | last post by:
Using 2.0 with Master Pages and a GlobalBaseClass for the content pages. I understand the easy part -- the hierarchical structure of a namespace naming convention -- but the 2.0 IDE does not write a signature for the developer and after getting a good start developing a 2.0 application I thought I should go through the code and start marking classes and with namespaces. I keep getting the following 'missing' error even when using a first...
11
1795
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I understand that you declare your intention to use a namespace within a page through the "Inherits" attribute. I know that using "Inherits" isn't absolutely necessary, it's just recommended so the developer doesn't have to type out the entire...
2
3568
by: Jack Li | last post by:
Hi, If I declare multiple namspaces, each in a separate file, how do I specify their path with the "using" directives? Say I have 2 namespaces and 1 main function, all in separate files such as follows ===================================== File1.cs: namespace A {
1
2188
by: juan blanco | last post by:
Hi all, I am trying to compile / rebuild a solution with msbuild to be part of our continuous integration. One of the projects aliases a referenced project to resolve confilicting namespaces. The problem ocurrs when MsBuild afterwards uses this same alias for the reminder of projects who reference this project. Can anybody help me with this? is it a bug or do i need to set something
1
4294
by: Ray | last post by:
Hello, I'm reading Mr. Flanagan's JS Definitive Guide 5th edition. I was wondering about a point he make in section 10.2 of the book: "Importing Symbols from Namespaces". He mentions in there that one can create an alias for the symbol defined in a namespace like this: // This is an easier name, to save typing.
0
9690
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
9551
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
10505
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
10033
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
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
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
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.