Re: Detect if assembly exists
- From: Bart Verkoeijen <BartVerkoeijen@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 Apr 2005 15:10:03 -0700
"William DePalo [MVP VC++]" wrote:
> For managed wrappers to the GAC interface:
>
> http://blogs.msdn.com/junfeng/articles/229649.aspx
Thank you! I needed that. It's a better resource then what I found.
> I'm not sure what your options are for assemblies outside of the GAC if, as
> you say, you don't want to load them.
Well, I have been thinking on that. And I think I have found a solution. Not
sure for that, so if someone could verify it?
I found out that I can get the AssemblyName of a .NET .dll file (aka
assembly) by simply calling the static method AssemblyName.GetAssemblyName().
The only parameter is a filename string.
The remarks of this method:
> This will only work if the file contains an assembly manifest. This method causes the file to be opened and closed, but the assembly is not added to this domain.
Now I only need to know the assemblies which the CLR would load in the
filesystem (not the GAC). I think I can determine the directory which the CLR
will try to search for the files by getting the AppDomain.BaseDirectory
property. However, does the CLR search in subdirectories? And ís this the
directory the in which the CLR will search?
With the directory I can search for .dll files, and try to get the
AssemblyName with the mentioned method.
And with the managed GAC interfaces I can search for the AssemblyName in the
GAC.
So this would be the answer to my question. But is it? Could someone verify
my solution?
.
- References:
- Detect if assembly exists
- From: Bart Verkoeijen via . NET 247
- Re: Detect if assembly exists
- From: William DePalo [MVP VC++]
- Detect if assembly exists
- Prev by Date: Re: Arrays and Thread Safety
- Next by Date: Re: Gc Mystery
- Previous by thread: Re: Detect if assembly exists
- Next by thread: Re: Detect if assembly exists
- Index(es):
Relevant Pages
|