tags:

views:

581

answers:

3

Is it possible to do this natively without addons or 3rd party tools?

I know there is the gacutil, but there is not an exe to run, otherwise i could've called it from the Exec task.

Has anyone done something similiar?

+1  A: 

Gacutil.exe is the standard supported tool for doing "dev box" installations of .NET assemblies. I would recommend simply using the Exec task as you mentioned to invoke it if you want to GAC your assemblies as part of a build task.

If you really want to do this without creating a new process, then you'd have to write a custom MSbuild task to implement the COM interop calls required to do what gacutil.exe does. Junfeng Zhang's blog post would be a good starting point if you want to go this route.

bobbymcr
A: 

The gacuti.exe can be in more than one place. It's not on the system %path% variable, so you'll have to use the full path (it will not run otherwise).
I use C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\:

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -i MyAssembly.dll

It was reported to be found on other locations as well:

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\gacutil.exe
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe
C:\Program Files\Microsoft Visual Studio 9.0\VC\gacutil.exe

An easy way to find it is using the windows search, or the command line: dir gacutil.exe /s /a.

Unfortunately, I have seed some servers where gacutil wasn't found, and I had to install the dlls manually.

Kobi
Officially, gacutil is an SDK tool, so the most "correct" location would be the path found in the registry key "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows" under the value "CurrentInstallFolder".
bobbymcr
That's good do know. Thanks.
Kobi
+1  A: 

Hi!

You should use the "GacUtil" task, from MSBuild Community Tasks (free). I think this is cleaner than calling the executable.

Regards,

Olivier.

Olivier