External Assembly version

  • Thread starter Thread starter Jared
  • Start date Start date
J

Jared

Hi,

I would like to get version of external assembly but I do not know the
path..

// now get an external assembly
AssemblyName anm =
AssemblyName.GetAssemblyName("c:\\winnt\\microsoft.net\\framework\\v1.0.3705\\my.component.dll");
// and show its version
Console.WriteLine(anm.Version.ToString());
 
I would like to get version of external assembly but I do not know
the path..

Good to know. And what's your question?
Do you need instructions to search the c-drive recursively for the
assembly? Or is the assembly already loaded and you can go through all
loaded assemblies?

Sorry for not getting the point you are on!
Markus
 
The assembly should be loaded, so how would I get version of loaded
assembly?

string searchedd = "mycomponent.dll"
foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies())
{
if (ass.Name == searched) Console.Write(ass.GetName().Version);
}

hth
Markus


PS. For you personal use, have also a look at
http://www.netmeister.org/news/learn2quote2.html. This makes it much
easier for other readers of your questions and it is more likely, that
you get a good and fast answer.
 
Back
Top