Assembly access
If you have a assembly identity/namespace of Library.Testing
.
Then you created another assembly with identity/namespace of Library.Testing.One
Library.Testing.One
project references Library.Testing
.
Why is it you have to use using Library.Testing;
in your classes in Library.Testing.One
to access anything in Library.Testing
?
Example1:
using System;
namespace Library.Testing.One
{
// 'Library.Testing' is a reference in this assembly
public class foo : Library.Testing.BooBase
{
}
}
This does not work I get two exception
Warning 1 Load of property 'RootNamespace' failed. The string fo开发者_开发技巧r the root namespace must be a valid identifier. Error 2 The type or namespace name 'BooBase' does not exist in the namespace 'Library.Testing.One.Library.Testing' (are you missing an assembly reference?)
Example2:
using System;
using Library.Testing;
namespace Library.Testing.One
{
// 'Library.Testing' is a reference in this assembly
public class foo : Library.Testing.BooBase
{
}
}
This works!
Adding a "using" for Library.Testing.One
does not automatically bring everything in Library
and Library.Testing
into scope. The fact that the namespaces appear to be hierarchical is probably what's leading to your confusion.
Think of, for example, adding using System.Data.SqlClient
to a file. That doesn't automatically bring everything in System
and System.Data
into scope.
精彩评论