Visual Studio引用COM時出現警告的處理辦法

來源:互聯網
上載者:User

     According to a comment in the MDSN article about TLBIMP for 2.0, you can't fix this problem w/o running TLBIMP yourself.

It was easy to reproduce your problem using VS. I also reproduced it running TLBIMP manually from a VS comment prompt:

     tlbimp c:\WINNT\system32\activeds.tlb /out:interop.activeds.dllThe fix was to use the /silent switch

     tlbimp c:\WINNT\system32\activeds.tlb /silent /out:interop.activeds.dllAs pointed out in the comment in the MSDN article, the COM reference becomes a .net assembly reference to the interop assembly you built yourself.

I'm not a VS expert, but I made this work by adding a prebuild to project of:

      "$(DevEnvDir)\..\..\SDK\v2.0\bin\tlbimp" c:\WINNT\system32\activeds.tlb            /namespace:ActiveDs /silent /out:"$(ProjectDir)interop.activeds.dll"Built it once so I'd have a dll to add a reference with the browse tab. Added a reference to the interop.activeds.dll in my project root and then built again. You may want to do this some other way, like with an external make file via a C++ project. This is more of a POC.

Note a funny difference in MSBUILD vs VS, $(DevEnvDir) has a trailing backslash but MSBUILD does not.

 

參考:

http://msdn.microsoft.com/en-us/library/tt0cf3sx%28VS.80%29.aspx

http://stackoverflow.com/questions/269063/lots-of-build-warnings-when-com-objects-activeds-or-msxml2-are-referenced

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.