Cannot register assembly during Team Build (and I don't want too)


I have a solution that contains a project with the "Make assembly COM-Visible" checked and I get the following error when I attempt to run a team build:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (3885): Cannot register assembly "C:\Builds\1\TeamProject\Libraries - CI\bin\Debug\Mydll.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\Mydll' is denied.


Pass "/p:RegisterForComInterop=false" to MSBuild using the MSBuild Arguments process parameter of your build definition.


The service account running my build agent is not an adminstrator on my build.  Therefore; it does not have permissions to write to the registry to register the COM assembly.  Because this is my build machine I have no desire to have the COM assembly registered on this machine. I simply what the solution to build.

When the "Make assembly COM-Visible" is checked the project file is changed to include a target to register the assembly. That target has a condition testing if RegisterForComInterop is true.  By passing the values to MSBuild you are overriding the default value of True with False.  This will allow the project to compile and skip the step to register.

Comments are closed