Groups | Blog | Home
all groups > dotnet sdk > august 2007 >

dotnet sdk : Uninstalling from Global assembly cache


Matt
8/7/2007 12:24:02 PM
I am trying to install and uninstall assemblies from GAC.
I created a batch file which has following command in it:
gacutil.exe /if MyCommonAssembly.dll
Above command successfully installs MyCommonAssembly in GAC.
But when I create a another Batch file which contains:
gacutil.exe /u MyCommonAssembly
and I run the batch file, the command is executed but the assembly is
appears in GAC and Windows --> Assembly folder.

if I execute this command on cmd prompt then it is uninstalled from the
Assembly folder and also from the GAC.
Any suugestions?



Phil Wilson
8/7/2007 1:04:09 PM
You're using /if to force replacement - does that mean there is already an
assembly of that name in the GAC? Is that the only option in your command
(you didn't do /r?).

Does /uf make any difference? How about if you specify more of the assembly
name (for example adding version)?
--
Phil Wilson
[MVP Windows Installer]

[quoted text, click to view]

Matt
8/7/2007 1:20:00 PM
does that mean there is already an assembly of that name in the GAC?
Yes, GAC has an assembly with same name. But I run Uninstall batch file
before Install Batch file.

Is that the only option in your command?
Yes, that is only option I have specified in my command.

Does /uf make any difference?
No, using /uf didnt make any difference.

How about if you specify more of the assembly name?
Well, I didnt try this option but for my purpose I am creating an installer
which in Pre install event uninstalls all the assemblies from the GAC and in
POSTInstall event installs new assemblies in GAC.
Please let me know if you require more information.

[quoted text, click to view]
Phil Wilson
8/7/2007 2:48:13 PM
You mean a setup&deployment project? That "pre-install" event sounds like
you're running this code in a setup project, which might mean you're running
custom actions in the context of Windows Installer, and that might be
affecting things because in an Installer class you're running impersonated
on an msiexec.exe process.

If you are actually using a setup&deployment project, you should know that
you can get the setup project to install/uninstall assemblies in the GAC
without running any code at all.

I'd also point out that gacutil is not redistributable and is not in most
..NET FW redists, so it won't exist on client systems.

--
Phil Wilson
[MVP Windows Installer]


[quoted text, click to view]

wawang NO[at]SPAM online.microsoft.com (
8/8/2007 12:00:00 AM
Hi Matt,

I agree with Phil, if you're calling GacUtil from an installer, you first
need to be aware that GacUtil isn't redistributed with .NET Framework
Runtime; it's in the .NET Framework SDK.

Normally the setup tool may already have builtin support for installing and
uninstall assembly to/from GAC.

My wild guess is that gacuti.exe isn't found at all by the batch file, the
error is missed since you cannot see the output if it's executed silently.

Also, if you do need to call Gacutil.exe from your installer, you should
also be use the "-ir" or "-ur" switch since it can correctly
install/uninstall using reference counts. This will make sure other
programs that are using the shared assembly will not break when one program
is uninstalled.

#Global Assembly Cache Tool (Gacutil.exe)
http://msdn2.microsoft.com/en-us/library/ex0ss12c(vs.80,d=printer).aspx
<quote>
Be aware that using the /i and /u options alone does not support reference
counting. These options are appropriate for use during product development
but not for actual product installations.
</quote>


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
AddThis Social Bookmark Button