Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make COMReference work in Azure CI/CD pipeline

I have used a dll to my project which gets added to my project file as a COMReference like following

<COMReference Include="GENERALCREDITREQUESTMANAGER450Lib">
  <Guid>{BDB6DDB5-5C02-492F-954E-68ED3D8F075D}</Guid>
  <VersionMajor>1</VersionMajor>
  <VersionMinor>0</VersionMinor>
  <Lcid>0</Lcid>
  <WrapperTool>tlbimp</WrapperTool>
  <Isolated>False</Isolated>
  <EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>

Now the problem is it fails during my pipeline build, saying Namespace or type GENERALCREDITREQUESTMANAGER450Lib can't be found which is understandable because unlike other references it doesn't have any HintPath to locate the dll.

After looking around a bit I found this article that basically says use tlbImp to generate the dll and then reference that dll using the following syntax:

<Reference Include="GENERALCREDITREQUESTMANAGER450Lib">
  <HintPath>InteropAssemblies\GENERALCREDITREQUESTMANAGER450Lib.dll</HintPath>
  <EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>

But if I do that then my visual studio build fails, because then VS can't find the namespace even though it's added to the reference. One of the post suggested to use COMFileReference instead of COMReference but that ends up with same "Namespace not found" error.

How can I make the pipleline working?

like image 203
SZT Avatar asked Oct 28 '25 17:10

SZT


1 Answers

The COMReference item requires the library to registered on the build server which may be hard to do depending on the environment.

The way to use tlbimp locally and add the generated .dll to the project sources is likely more compatible for your setup though it requires you to pass the namespace as a parameter (/namspace:GENERALCREDITREQUESTMANAGER450Lib) to achieve the same result as the COMReference.

like image 151
Martin Ullrich Avatar answered Oct 31 '25 12:10

Martin Ullrich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!