C# VS 2005 Class Library / Windows Form Frustration (BUG?)

  • Thread starter Thread starter Shawn B.
  • Start date Start date
S

Shawn B.

Greetings,

I may have encountered a bug, but a very frustrating one. Took me hours to
figure out what the problem is and how to reproduce it. The best way to
explain how to reproduce it is to explain my need, I want to create a
library called "CompanyName.Console" and have a class called Console. But,
I don't want the fully qualified namespace and object to be
CompanyName.Console.Console (because it is redundant). so do these steps:

1. Create Class Library called "Test.Console"
2. Rename Class1 to Console and the constructure
3. Build it
4. Change the namespace to read CompanyName (instead of CompanyName.Console)
5. Add a new Windows Form. You'll get a Designer exception.

If you omit step 4, it works just fine.

Is this a bug or design by behavior?


Thanks,
Shawn
 
You should change the Default namespace property of your project. All
new classes are created in the default namespace, which is Test.Console
for your project. You have created a class with the same name as the
default namespace name, thus rendering the namespace name unavailable.

i.e. you cannot have the following:

class Console in namespace Test
class Form1 in namespace Test.Console

as Test.Console would refer to both a namespace and a class

HTH,
Stefan
 
Back
Top