Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS Build server and COM references - does this work?

On my Developer PC i have registered the according dll´s and referenced them. (Add reference -> COM) On the TFS build server this of course causes errors since the references are not registered there and wont be in the future.

What is the best way to circumvent this?

like image 810
Enrico Avatar asked Sep 21 '11 10:09

Enrico


1 Answers

Using tlbimp.exe directly is not necessary. Try replacing any <COMReference> items in the project file with <COMFileReference>. An example would look like this:

<ItemGroup>
   <COMFileReference Include="MyComLibrary.dll">
     <EmbedInteropTypes>True</EmbedInteropTypes>
   </COMFileReference>
</ItemGroup>

The COM dll doesn't need to be registered on the machine for this to work.

Each COMFileReference item can also have a WrapperTool attribute but the default seems to work fine. The EmbedInteropTypes attribute is not documented as being applicable to COMFileReference, but it seems to work as intended.

See https://docs.microsoft.com/en-ca/visualstudio/msbuild/common-msbuild-project-items#comfilereference for a little more detail. This MSBuild item has been available since .NET 3.5.

like image 147
David Johnston Avatar answered Sep 30 '22 18:09

David Johnston