Skip to content


Copy assembly / DLL to GAC in batch script

How to install DLL files in GAC

As a developer I often need to place dlls in GAC (Global Assembly Cache) via scripts. This is easily done using gacutil.exe. xcopy can’t be used since the c:\windows\assembly folder is not really a normal folder.

I will give 2 examples that can be used as postbuild scripts in Visual Studio if you place it in a .bat file.

Example 1 (Windows Server 2003):

@SET GACUTIL=”c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe”

Echo Installing mydll in GAC
%GACUTIL% -if bin\debug\mydllL.dll

Example 2 (Windows Server 2008):

@SET GACUTIL=”C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe”

Echo Installing mydll in GAC
%GACUTIL% -if bin\debug\mydllL.dll

Please not that gacutil is not really made to deploy your DLLs in production environment. It’s a developers tool, and thats the reason it’s not a standard file in Windows 2003, Windows 2008. It’s part of .NET SDKs.

For production environment you can use .msi packages and various installers and also setup project form Visual Studio.

  • Delicious
  • Digg
  • Twitter
  • Facebook
  • LinkedIn
  • TechNet
  • StumbleUpon
  • NewsVine
  • Technorati Favorites
  • Slashdot
  • MSDN
  • Share/Bookmark

Related posts:

  1. Failure adding assembly to cache… Windows Vista gacutil problem / error

Posted in Visual Studio.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.