Can i give alias to a dll?

  • Thread starter Thread starter Julia
  • Start date Start date
J

Julia

Hi,

My host application loading plugins at runtime
How can I dynamically load types from a dll without
specify the name of the dll in my application or in a config file
can I give a dll an alias?

assuming i have two implemnatations of a messaging service(only one should
be installed)

1.smtp.dll
2.exchange.dll

insetad of
LoadType("smtp.dll")

I would like to write
LoadType("Messaging")

when installing the exchange.dll i will still uses

LoadType("Messaging")

Thanks.


BTW:I do specify the type of object to create in the app.config.
 
Julia said:
Hi,

My host application loading plugins at runtime
How can I dynamically load types from a dll without
specify the name of the dll in my application or in a config file
can I give a dll an alias?

assuming i have two implemnatations of a messaging service(only one should
be installed)

1.smtp.dll
2.exchange.dll

insetad of
LoadType("smtp.dll")

I would like to write
LoadType("Messaging")

when installing the exchange.dll i will still uses

LoadType("Messaging")

Thanks.


BTW:I do specify the type of object to create in the app.config.

<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<add key="Messaging" value="smtp.dll" />
</appSettings>


LoadType(ConfigurationSetting.AppSettings["Messaging"]);

bye
Rob
 
Julia,

The closest you can come to this would be to call the static
LoadWithPartialName method on the Assembly class, and make sure that the
assembly is loaded in the GAC. In this case, you could do something like:

// Get System.Data.dll.
Assembly a = Assembly.LoadWithPartialName("System.Data");

However, AFAIK, you can't set an alias up.

Hope this helps.
 
Back
Top