开发者

Need fully qualified type name

开发者 https://www.devze.com 2022-12-22 19:14 出处:网络
I need to resolve an assembly and type at runtime and I need to find the fully qualified type name.For some reason I cannot get it right, as I keep get an exception saying it cannot find the type spec

I need to resolve an assembly and type at runtime and I need to find the fully qualified type name. For some reason I cannot get it right, as I keep get an exception saying it cannot find the type specified.

The app.config file, in which the assembly to look for is defined, looks like this:

<configSections>
    <section name="modules" type="Microsoft.Practices.Composite.Modularity.ModulesConfigurationSection, Microsoft.Practices.Composite"/>
  </configSections>
  <modules>
    <module assemblyFile="G:\Data\Visual Studio 2008\Projects\Race Management System.Shell\ConfigurationModularity\bin\Deb开发者_如何学Pythonug\Modules\Driver.Data.Module.dll" moduleType="Driver.Data.Module.DriverDataModule, DriverDataModule" moduleName="Driver.Data.Module.DriverDataModule"></module>
  </modules>

The assembly is called: Driver.Data.Module Namespace in assembly is: Driver.Data.Module and type name is: DriverDataModule, and this is also the name of the .cs file.

I cannot seem to find how to specify the name correctly in the xml file. Can somebody help me with the fully qualified type name?

This is for a Composite WPF application.

Thanx!


Try Driver.Data.Module.DriverDataModule, Driver.Data.Module.

You can also find the full assembly-qualified name of your type by instantiating an object of that type and examining the AssemblyQualifiedName property of its Type:

DriverDataModule module = new DriverDataModule();
string fullyQualifiedName = module.GetType().AssemblyQualifiedName;


What error do you get? If you're having a hard time getting a full error message out of the app, and you think your app is having problems loading the assembly itself, you can use the fuslogvw tool to log full details to disk.

It's worth also opening the assembly in Reflector to double-check the assembly's full name (displayed on the bottom-left of the window when you open Reflector), and to check that the type is in fact defined in the namespace you think it is.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号