views:

365

answers:

2

I have a namespace conflict between two referenced assemblies:

i.e., I'm referencing Foo.A.Foo and Foo.Bar, so when I say I want Foo.Bar.Control, VS is trying to find Foo.A.Foo.Bar.Control

I can twiddle the Designer.cs code by adding new global:Foo.Bar.Control(), but as soon as I change anything, VS switches back.

I know there's something about adding aliases directly to the reference, I've tried but haven't managed to find the right combination (inline alias, using alias, reference alias).

Help?

A: 

"extern alias" may be what you mean, but I'm not sure what the designer will do with it, unfortunately...

I'm not even sure that's what you're after though - that's normally for two types from different assemblies with the same name.

You can write namespace aliases with a using directive, e.g.

using FooControl = Foo.Bar.Control;

but again, the designer is going to rewrite your code...

Jon Skeet
I don't want this to be the answer, (sob)!
Benjol
A: 

OK, this isn't the answer, but it's what I found for a workaround:

namespace FooBar
{
    class FooBarControlHack : Foo.Bar.Control { }
}

So I can do the following in the Designer.cs :

this.fooBarControl = new FooBar.FoorBarControlHack();
Benjol