Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Namespaces across assemblies

Status
Not open for further replies.

Stedo

Programmer
Sep 15, 2005
44
SE
hi,

I'm writing a number of assemblies and because of problems with circular dependencies I have to split related objects into seperate assemblies. In order to maintain good organisation in the code I create namespaces for the objects and I want to have objects in different assemblies belong to the same namespace but I'm having real problems here. Classes aren't found during build and namespaces aren't found during build even although I have added the correct references to the project. Is it possible to have the same namespace over a number of assemblies?

Thanks
Steve
 
in all the projects properties change the rootnamespace to the same name and then all the assemblies should be in the same namespace.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
hi,

I have root namespace as the same name, for example:

Assembly: Library1
Namespace: Rootname.Datatypes
Objects: ObjectA, ObjectB, ObjectC

Assembly: Library2
Namespace: Rootname.Datatypes
Object: ObjectD, ObjectE

When I create references in my project to both Library1 and Library2 I cannot see the objects in Library2.

Thanks for the help
Steve
 
What you're trying to do is done via Modules, which aren't supported by VS.NET. If you want to use them, you'll need to drop into the command-line to compile & link.

In your MSDN help collection, search on the Module class, the csc.exe compiler (look at the /target:module option) and the al.exe linker (combines modules into an assembly).

If this is too much work, you'll need to refactor so that your common functionality has it's own namespace and it's own assembly, and then set references to it.

Chip H.


____________________________________________________________________
Donate to Katrina relief:
If you want to get the best response to a question, please read FAQ222-2244 first
 
Chip is right.

Using modules is not a very object oriented approach to programming. You will want to re-architect your solution and re-factor your code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top