tags:

views:

370

answers:

3

Hi
I need to register an assembly in the GAC using batch file. Is there a way to find the installation location of GacUtil.exe or is there a way to register the assembly without GacUtil?

Thank you,
Adi Barda

+2  A: 

GacUtil is not installed with a framework install only with an SDK install - so you couldn't guarantee it would be on the box you're installing on.

This won't work within your batch file but if you have developed the application yourself you can use the GacInstall method described below:
http://msdn.microsoft.com/en-us/library/system.enterpriseservices.internal.publish.gacinstall.aspx

Alternatively I'd recommend producing an msi file to deploy the application. Tutorial here:
http://www.dreamincode.net/forums/topic/58021-deploying-a-c%23-application-visual-studio-setup-project/

It would be an inadvisable solution to include a copy of GacUtil.exe in your distribution because it comes under a different licence and you probably aren't licenced to redistribute it

Rick
A: 

it is easy to make a bat file (for instance NET 1.1 ) where set gac util path:

set EXEC_CMD=%windir%\Microsoft.NET\Framework\v1.1.4322\GacUtil.exe

Arseny
strange it is fair only for NET 1.1
Arseny
A: 

Your bestbet is to use a powershell script that wraps Publish.GacInstall, such as this one

David Reis