I received an interesting error today while setting up a new TeamCity build-server. When running the MSBuild Microsoft.Sdc.Tasks GAC uninstall task – GlobalAssemblyCache.GacHelper.Uninstall – I kept receiving the following error:
C:SubversionTrunkBizTalkBuildCommon-DeploymentCommonDeployment-Cleanup.proj(59, 3): A task error has occured.Message = Failed to uninstall CandidateMarks.Canonical, PublicKeyToken=1b76b267b587386b from the GAC. AssemblyName = CandidateMarks.Canonical, PublicKeyToken=1b76b267b587386b at Microsoft.Sdc.Tasks.GlobalAssemblyCache.GacHelper.Uninstall(String name) at Microsoft.Sdc.Tasks.GlobalAssemblyCache.RemoveAssembly.InternalExecute() at Microsoft.Sdc.Tasks.TaskBase.Execute()
It turns out that the user attempting to uninstall or install assemblies to the GAC needs write permissions to the %systemdrive%WindowsAssembly directory (as documented here and here). Adding that user to either the local computer Power Users or Administrators Group provides the necessary permissions and the above error is no longer an issue.