If you install an assembly with the same Name as one that is already in
the GAC, it will simply overwrite it. Was there a problem you were
having with dups or something?

-bc

-----Original Message-----
From: Sam Gentile [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 29, 2002 5:29 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET] How do we programatically determine if GAC contains
particular assembly?


I have an installer program that needs to know whether PIAs are already
installed in the GAC so that I won't install them twice. So the question
is how can we programmatically tell whether the GAC contains a
particular assembly?

References:

I found these articles:

Assembly.Load Method (AssemblyName)
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemreflectionassemblyclas
sloadtopic1.htm

Assembly.LoadWithPartialName
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemReflectionAssemblyClas
sLoadWithPartialNameTopic.htm

How the Runtime Locates Assemblies
ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconhowruntimelocatesassemblie
s.htm

The third article says that if you want to load an assembly from the GAC
as opposed to just from the app directory, you need to call
Assembly.LoadWithPartialName rather than Assembly.Load.

This is the best answer I've found so far: try to load the assembly then
if that fails, then the assembly isn't there. This is lame, however. We
don't want to load the assembly, we just want to know whether it exists
or not.


---------------------
Sam Gentile
.NET Consultant
Co-author: Wrox Visual C++ .NET: A primer for C++ developers
BLOG: http://radio.weblogs.com/0105852/
http://www.project-inspiration.com/sgentile/DotNet.htm
http://www.project-inspiration.com/sgentile/
---------------------------




_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail.
http://www.hotmail.com

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to