Assembly class changed without keeping compatibility in .NET 2 ?

W

WT

Hello,
I am migratingcode from .NET 1.1 to 2 (Raibow project) and in this code we
where storing assembly name in database just to be able to load it
dynamically later.
Code in the register method was
// Get Assembly name

string assemblyName = portalModule.GetType().BaseType.Assembly.CodeBase;
assemblyName = assemblyName.Substring(assemblyName.LastIndexOf('/') +1);
//Get name only

this code was giving the simple assembly name

this has been broken in .NET 2 as we get the name of the temporary assembly
generated by compiler, each call gives a different name.

How to get the ability to get dynamically the name of an assembly ?

Thanks for help.

CS
 
L

Luke Zhang [MSFT]

To get the assembly name from current executing application in .NET 2.0,
you may use following code:

System.Reflection.Assembly.GetExecutingAssembly().FullName

Hope this help,

Luke Zhang
 

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

Top