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

Hello,

  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

4 comments
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:
http://stackoverflow.com/questions/1387582/how-to-install-assembly-to-gac-using-msbuild

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.

0
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

0
Comment actions Permalink

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

0
Comment actions Permalink

Thanks,

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

  Anyway I am using http://msbuildextensionpack.codeplex.com/ for running the GAC from msBuild.

Stefan

0

Please sign in to leave a comment.