How can I add assembly into GAC in TeamCity using MSBuild?


  To be able to execute some of our tests I need to put an assembly into GAC after it is build.

  However, when I run gacutil executable on my machine it is complaining that I need to run it using elevated prompt.

  My question is: How can I add assembly into build machine GAC from the msbuild script run by TeamCity? Is it possible?

Thanks in advance, Stefan

Comment actions Permalink

TeamCity starts msbuild script. I suppose there is nothing special in registering assebmly in GAC with from MSBuild under TeamCity to be compared with registering assembly in GAC from MSBuild script running without TeamCity.

Please, have a look to the related descussion thread at:

Please note, you should check in your buildscript if there are some registered assemblies in GAC from previous build run(s) and unregister them prior to registering new assemblies.

Comment actions Permalink

Eugene, thanks for reply.

  I know how to add assemblies into gac from MSBuild.
  The problem is that in order to do so you need to run the process in the ELEVATED mode.

  Is there a way how to achieve this in TeamCity?

Thanks, Stefan

Comment actions Permalink

You may start build agent from administrative account.
Another approach is to start gacutil.exe from runas.exe utility.

Comment actions Permalink


  I disabled UAC for administrators on the build machines and I am now successfully running the build under admin account.

  Anyway I am using for running the GAC from msBuild.



Please sign in to leave a comment.