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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top