However, to make assemblies referrable to
COM-interop or
unmanaged code, they don't need to be installed in the GAC.
An assembly's filename, without its
extension .dll or
.exe, that is stored in the GAC must correspond to the name of assembly itself.
Viewing the content of the GAC
The content of the GAC can be viewed with
gacutil -l:
PS C:\Users\Rene> gacutil -l
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
The Global Assembly Cache contains the following assemblies:
Microsoft.Ink, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=AMD64
Microsoft.Interop.Security.AzRoles, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=AMD64
srmlib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=AMD64
…
XsdBuildTask, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
XsdBuildTask.resources, Version=4.0.0.0, Culture=de, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
Number of items = 979
Installing and removing assemblies into/from the GAC
An assembly is installed in the GAC either by
Install an assembly
P:\ath\to\xyz> gacutil -i TQ84.Foo.dll
Remove the assembly
P:\ath\to\xyz> gacutil -u TQ84.Foo
These commands must be executed with administrator privileges.
Testing if an assembly is loaded into the GAC
With Powershell, it is possible to test whether a specific assembly is loaded into the GAC like so:
# add-type -path $env:oracle_home\ODP.NET\managed\common\Oracle.ManagedDataAccess.dll
foreach ($assembly in ([AppDomain]::CurrentDomain.GetAssemblies()) ) {
if ( [System.Runtime.InteropServices.RuntimeEnvironment]::FromGlobalAccessCache($assembly) ) {
write-host "$assembly was found in GAC"
}
else {
write-host "$assembly was not found in GAC"
}
}