1

What is the protocol to share a namespace between two projects when consequential projects will reference both of the namespaces?

Obviously this is possible (System, mscorlib)...

I've gotten different errors depending on the things I've tried. Right now I have two projects Blueprint and Domain that share the MainApp namespace (for instance Blueprint has MainApp.IEntity and Domain has MainApp.EntityImpl). They are both referenced by a third project, Repositories. Repositories relies on both IRepository (in Blueprint) and EntityImpl (in Domain). Blueprint builds first, followed by Domain and then Repositories. For every reference to a class in the Domain project, I get a "The type or namespace name Domain does not exist in the namespace 'MainApp' (are you missing an assembly reference?)...

The assembly references are all correct.

I made sure there was a common assembly name between all the projects and adding an AssemblyInfo class in one of them with 'add link references to the root. This did nothing, and so I removed it.

I could merge these two projects, but there are circumstances in which that would be detrimental. I appreciate any guidance y'all can offer.

In response to the comment, Blueprint has no inter-project references, Domain has a dependency on Blueprint Repositories has a dependency on Blueprint and Domain

I have done all the deleting the dlls, building rebuilding cleaning repeating..no dice..

starblue
  • 55,348
  • 14
  • 97
  • 151
smartcaveman
  • 41,281
  • 29
  • 127
  • 212
  • When you say "the assembly references are correct", I'm suspicious that you believe they are correct but are not. would you please include what assemblies you have referenced from Repositories, or Common Assembly? By far the most likely issue you have is incorrect references. – Philip Rieck Jun 04 '10 at 13:00
  • I edited the post, read the bottom please and thank you. – smartcaveman Jun 04 '10 at 13:08

4 Answers4

1

I can't explain why, but I have a project with two class library projects defining same namespace and using framework 3.5. I referred them in a project using NET Framework 4.0 client profile and got the error you got. When setting it to NET Framework 4.0 it worked.

marcRob
  • 11
  • 1
0

I just ran into this issue. You need to make sure all your projects are the same version. A number of mines were a combination of .net 4.0 and 4.5; making them all reference to 4.5 fixed the issue for me.

kennydust
  • 1,135
  • 15
  • 17
0

Open both the dlls in reflector & flatten the namespaces (view -> options -> browser -> flatten namespaces).

See if that helps you figure out the reason of the problem.

shahkalpesh
  • 33,172
  • 3
  • 63
  • 88
0

I ended up resolving this by copying the code to a different solution. In retrospect I'm sure this was unnecessary. Looking back, I think the problem would have been fixed by deleting everything from the bin and obj folders.

smartcaveman
  • 41,281
  • 29
  • 127
  • 212