How get the default namespace of project csproj (VS 2008)

csprojnamespacesprojects-and-solutionsvisual-studio-2008

I have VS 2008 and csproj project (C# Library).

In properties of project, has an assembly name, and default namespace.
Note: each class has a namespace.

Is it possible, in runtime, get the value of default namespace ??

My target is use resources, and I need default namespace's value:

 Assembly assembly = Assembly.GetExecutingAssembly();

 //foreach (string resourceName in assembly.GetManifestResourceNames()){}

 Stream syntaxModeStream = assembly.GetManifestResourceStream(pathToResources
+ ".SyntaxModes.xml");

Update:

Pieter said I can't. Default namespace don't stored in assembly

var resource = assembly.GetManifestResourceNames().Single(p => p.EndsWith(".SyntaxModes.Xml"))

where is the default namespace stored ??

Only can I read using Addins Visual Studio (DTE object) ??

Best Answer

You can't.

The default namespace isn't stored anywhere within the assembly. It's just a project setting of Visual Studio.

What I tend to do is use the name of the assembly: Assembly.GetName().Name. The problem with this is that it only works if the assembly name has not been changed.

For your specific issue, you can use assembly.GetManifestResourceNames() and do some tests over those names, e.g.:

string name = assembly.GetManifestResourceNames().Single(p => p.EndsWith(".SyntaxModes.Xml"))