Aliasing duplicated namespaces in seperate dll's

  • Thread starter Thread starter OHM \( One Handed Man \)
  • Start date Start date
O

OHM \( One Handed Man \)

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
 
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>
 
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



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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top