This project has moved. For the latest updates, please go here.

Remove-GacAssembly : Has install reference



When I am trying remove DLL from GAC assemblies that was installed by GAC module, I am getting following error.

I executed command like this

Get-GacAssembly -version 4.5* |Remove-GacAssembly

the error I got like below, please help.

Remove-GacAssembly : Has install reference. The assembly has not been removed from the GAC because another install reference exists.

At line:1 char:50
  • Get-GacAssembly -version 4.5* |Remove-GacAssembly <<<<
    • CategoryInfo : PermissionDenied: (Adp.MajorAccoun...cdfbcf18a65ada4:PSObject) [Write-Error], WriteErr
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Remove-GacAssembly


LTruijens wrote Jun 11, 2014 at 5:48 PM

You will get that message when removing assemblies from the GAC that have an install reference. That usually means they are installed by an installer.

The commands below will show the install references

Get-GacAssembly -version 4.5* | Get-GacAssemblyInstallReference

The safe way to remove these assemblies from the GAC is using the uninstaller of installer that installed them. If you still want to remove them without using the installer you could create the correct install reference with New-GacAssemblyInstallReference and provide that to the Remove-GacAssembly -InstallReference parameter. Or remove the correct key in HKEY_CLASSES_ROOT\Installer\Assemblies\Global and try Remove-GacAssembly again. I might add that last option in a -Force parameter of Remove-GacAssembly in a future version of PowerShell GAC.

But since you say you're trying to remove the assemblies you just added yourself, it is not logical for them to have an install reference. Are you sure Get-GacAssembly -version 4.5* returns only those assemblies and not, lets say, System.Threading.Tasks.Dataflow from the .Net framework? Try executing Get-GacAssembly without Remove-GacAssembly and see what it is returning is what you expect.