如何使COMReference在Azure CI/CD管道中工作 [英] How to make COMReference work in Azure CI/CD pipeline

查看:87
本文介绍了如何使COMReference在Azure CI/CD管道中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用了一个dll,它像下面这样作为 COMReference 添加到我的项目文件中

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>

现在的问题是它在我的管道构建过程中失败,说无法找到 Namespace或GENERALCREDITREQUESTMANAGER450Lib类型,这是可以理解的,因为与其他引用不同,它没有任何 HintPath 来找到dll.

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.

环顾四周后,我发现了这个文章基本上说使用tlbImp生成dll,然后使用以下语法引用该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>

但是,如果这样做,我的Visual Studio构建将失败,因为VS即使将命名空间添加到了引用中,也无法找到该命名空间.其中一篇文章建议使用 COMFileReference 而不是 COMReference ,但最后会出现相同的找不到命名空间".错误.

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?

推荐答案

COMReference 项要求库在构建服务器上注册,具体取决于环境,这可能很难做到.

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

在本地使用 tlbimp 并将生成的.dll添加到项目源的方法可能与您的设置更兼容,尽管它要求您将命名空间作为参数传递(/namspace:GENERALCREDITREQUESTMANAGER450Lib )来获得与 COMReference 相同的结果.

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.

这篇关于如何使COMReference在Azure CI/CD管道中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆