Search code examples
c#commsbuildcontinuous-integrationtlbimp

off-site build of C# / COM solution possible?


I work on an integration server and now I would like to build a C#.NET 4.5 solution which refers to a COM library. The COM object is NOT installed on the CI machine.

I have a .tlb file at hand. I have already created the .dll using tlbimp.exe and included the reference in the .csproj file:

  <ItemGroup>
    <COMReference Include="myComName">
      <Guid>{theGUID}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>0</Lcid>
      <WrapperTool>tlbimp</WrapperTool>
      <Isolated>False</Isolated>
      <EmbedInteropTypes>True</EmbedInteropTypes>
    </COMReference>
  </ItemGroup>

However, the build raises following warning

   warning MSB3284: Cannot get the file path for type library "<theGUID>" version 1.0. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))

True, it is not registered. I would rather have compiler and linker to get the required type information from the generated .dll file.

Is there a way to proceed with the build without registering the COM .dll?

Thanks! Reinhard.


Solution

  • I had to remove the reference to the registered COM interface first. Then, the .dll worked fine. Thanks for answers!