Getting types of the executing assembly within a loaded library

  • Thread starter Thread starter Franz Pentenrieder
  • Start date Start date
F

Franz Pentenrieder

Hello,

i want to load Type's from executing assembly within a library that is
loaded by the main programm. Problem is a call like this works only for
Type's within the current assembly.

Type tempType = Type.GetType( "NamespaceFromTheMainProgramm.ClassName" );

So i tried something like this,

System.Reflection.Assembly tempAssebmy =
System.Reflection.Assembly.GetExecutingAssembly();
Type tempType = tempAssebmy.GetType(
"NamespaceFromTheMainProgramm.ClassName" );

But this also dosen't work. Is there any way i can get this Types?
 
Try the full name for a type:

Type tempType =
Type.GetType("NamespaceFromTheMainProgramm.ClassName, LibraryAssembly");
 
Hello,

thanks - this worked fine. Is there any way i can get the name of the
executing assembly dynamicaly within the library?
 
Hello,

that dosen't work - it only gives me the default namespace i definied for
the project but not the assemblyname itself. This property behaves different
for the compact framework, i tried it in a windowsforms app - there it works
like it should.

any known workaround for this?
 
Sorry i have to correct this, it seems the problem is not the fullname
property it is the the GetExecutingAssebly() method. i always get the
assembly which im calling the function in. (in my case the namespace is the
lib's name so i got that confused)

so i guess that's the same problem as before, but this time i can't append
the real name because that's what i want to get...
 
You may try this:
typeof(LibraryNamespace.SomeTypeFromLibrary).Assembly.FullName
 
Back
Top