Visual Studio Namespaces, Aliases, and Form Designer

I had a problem with conflicting namespaces and code that are automatically generated by the form designer in Visual Studio 2008. I have a search in many forums and other documentation, but I could not find a solution to this problem.

I have one assembly called Foo.dll with the following space / code:

namespace Foobar.System
{
    public class MySystemClass() { }
}

Then I have another assembly that contains som of commonly used forms:

namespace Foobar.MyCommonForms
{
    public class MyForm : System.Windows.Forms.Form
    {
        public void SomeMethod()
        {
            var systemclass = new Foobar.System.MySystemClass();
        }
    }
}

The following error is displayed here in compilers: The type or namespace "Windows" is not part of the namespace "Foobar.System". Obviously, the compiler is trying to find the System.Windows.Forms.Form class in the Foobar.System.Windows.Forms namespace!

, "x" "global", Foo.dll "extern alias x" "x::", Foobar.System. .

, . , , , 'global::' System.Windows.Forms(, global:: System.Windows.Forms.Button), , , , , "global::" .

, : , 'x', Foo.dll, , ? Foobar.System - - .

+5
1

, , .

, Resharper Refactor! . .

0

All Articles