Suppress tlbimp warnings in visual studio

馋奶兔 提交于 2019-12-05 11:54:33

unless the COM library is constantly changing it's COM interfaces you could run the typelib importer once and then refer to the interop assembly in your project from then on. If you have reg free COM all that's needed is that the COM library be copied into your build output folder.

I ended up using the BeforeBuild target to explicitly invoke tlbimp.exe:

  <Target Name="BeforeBuild">
     <Exec Command="tlbimp /silent ..\3rdparty\comlibrary.dll /out:..\bin\interop.comlibrary.dll" />
  </Target>

This does require referencing the interop.comlibrary.dll binary, resulting in a little yellow warning sign on the reference in visual studio when opening the project before the first build.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!