Register Assemblies Into GAC From VisualStudio 2010

Introduction:

We have a situtaion where many third party assembly files [DLL] or even the Microsoft assemblies are also required to add to our application.

There are multiple ways to use the assemblies and this article helps you to know how to use the assembly registered to the GAC, which can be used by any application hosted or executing in the machine.

Prerequisites:

Assemblies must be signed.

Build Events:

Post-build event command line:

call "$(ProjectDir)GACRegistry.bat"

GACRegistry.bat

REM For 64bit Operating Systems

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64\gacutil.exe" -i "<Your signed DLL path>" >> GACRegistry.log

REM For 32bit Operating Systems

REM "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe" -i "<Your signed DLL path>" >> GACRegistry.log

After this whenever you compile the solution it will register required DLLs into GAC,

(C:\Windows\Microsoft.NET\assembly\GAC_MSIL)

I made this article simple easy and clear, so even a beginner can read and understand the concept within short duration of time.