Click or drag to resize

GAC

Programming assembly for GAC

Assembly as "Strong Name"

Assembly must be strong name to install GAC. Also the linking other assemblies requires it.

Make assembly as strong name

  1. Go to Project, Properties, register Signing

  2. Checked "Sign the assembly"

  3. Selection in drop-down list "Choose a strong name key file" (new or browse a SNK file)

Assembly to GAC

GAC folder is
%windir%\Microsoft.NET\assembly\

DLL install to GAC

  1. Go to Project, Properties, register Build Events

  2. "Post-build event command line:"
    "C:\Program Files\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil" /if "$(TargetPath)"

    Important: tool GACUtil run must as administrator

    gacutil /if assemblyPath

    Installs an assembly into the global assembly cache. If an assembly with the same name already exists in the global assembly cache, the tool overwrites it. Specifying this option is equivalent to specifying the /i and /f options together.

Use an assembly from GAC

Starting with the .NET Framework 4, the default location for the Global Assembly Cache is
%windir%\Microsoft.NET\assembly.
In earlier versions of the .NET Framework, the default location is
%windir%\assembly.

Reference to an assembly from GAC

  1. Go to Project, References

  2. Content menu, "Add Reference..."

  3. Dialog "Reference Manager", choose DLL from GAC or a Project

  4. Important: Reference property value "Copy Local" must be False

See Also