This project is read-only.

MSBuild.ExtensionPack.Framework.Gac returns error code 9

Dec 8, 2010 at 10:04 AM


 I am using the MSBuild.ExtensionPack.Framework.Gac to gac a dll remotely on a Virtual Machine (the VM runs on my desktop). I am admin of the VM and I can also remote connect to it.

Here is the task configuration:

<MSBuild.ExtensionPack.Framework.Gac TaskAction="AddAssembly" AssemblyPath="$(OutputDir)$(BTSDLL1)" RemoteAssemblyPath="$(RemoteAssemblyPath)$(BTSDLL1)" MachineName="$(Server)" Force="true"




The error message is : Remote AddAssembly returned non-zero returnValue: 9

Is there anyone who could knows about the meaning and has an possible solution?


Kind regards,


Dec 8, 2010 at 10:15 AM



Do you have Gacutil in the remote servers Path environment variable?


see this:



Dec 8, 2010 at 10:47 AM

Hi Mike,


Thanks for your prompt response. I now do not have any error message anymore but the dll is not placed in the GAC :(



Dec 8, 2010 at 11:36 AM

can you run with /v:diag and post the output.

Dec 8, 2010 at 12:29 PM


Here is the log

  Task "MSBuild.ExtensionPack.Framework.Gac"
    GAC Assembly: \\BTS-DEVFM9346\C$\Temp\HelloWorld.dll on Remote Server: BTS-DEVFM9346
    Deleting old Remote Assembly: \\BTS-DEVFM9346\C$\Temp\HelloWorld.dll
    Copying Assembly from: C:\Program Files\Microsoft BizTalk Server 2006\SDK\Samples\Orchestrations\HelloWorld\releases\MSBuild\HelloWorld.dll
    to: \\BTS-DEVFM9346\C$\Temp\HelloWorld.dll
    ManagementScope Set: \\BTS-DEVFM9346\root\cimv2
    Process ReturnValue: 0
    Process ID: 136
  Done executing task "MSBuild.ExtensionPack.Framework.Gac".


The copy part looks correct and i see that the timetamp of the \\BTS-DEVFM9346\C$\Temp\HelloWorld.dll file is the time at which the msbuild task runs so the copy part seems fine.

2 things i have doubt on:

- What's the managementscope set?

- The log does not seem to output the fact that the gacutil.exe is actually called but I am not sure if it's supposed to be logged.


Thanks for your help,


Dec 9, 2010 at 9:32 AM

That looks fine. I'll try repro later today. Just to be sure, can you pass in a username and password.


Dec 9, 2010 at 10:10 AM



I have found the issue. I was pointing to the wrong version of gacutil.exe! I use a virtual machine I have been given and I was expecting it to have all the necessaries .Net versions and SDK but one version of the SDK was missing.


So, for example, when I try to locally gac a .Net 2.0 assembly using the gacutil.exe version of the .Net 1.1 SDK, I got the following error:

Microsoft (R) .NET Global Assembly Cache Utility.  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Failure adding assembly to the cache: Unknown Error


The msbuild gacutil task nevertheless did not pick up the error and went through fine - making the msbuild target to succeed. I've had a quick look at the source code of gac.cs and it looks like it's because the gacutil.exe does not return an error code when failing for an unknown error... Anyhow, I think that this case is probably quite rare as I should have looked if i had to correct version of the gacutil.exe first.


Thanks again for your help!

Kind regards,


Dec 9, 2010 at 10:29 AM

Great. Thanks for logging the detailed reply.