Building COM Visible SharePoint Components Caused TFS Build Server Error

Toggling com visibility determines how COM clients access your managed SharePoint code, and good design dictates that assemblies explicitly indicate COM visibility. While dealing with COM based SharePoint Components remember that COM is an interface-based framework, which depends on the contract being defined, and immutable, through which you access implementations.

When using Build Server, you may find that marking SharePoint components as being COM visible you may get an “access denied” error, generally when the assembly is part of the team build but not being to registered on the build server. As such, the goal is to make a build ComVisible while preventing registration of the component into a COM library. To get around this error, uncheck RegisterForComInterop in Build Tab of Project Property Page, and uncheck it for the Configuration and Platform used in Team Build.