0

I have a project that I am developing that uses a third party COM library as a reference and I would like to build this project on a Visual Studio Team Services build client. My first idea is to create a MSBuild task that checks to see if the COM library is installed on the local computer and if it is not, go ahead and install it, but this seems like a really messy way to do this. I have searched around but it seems as though all the answers date back years and I can't seem to make the few I have found work in a VS 2013 project. How have other people solved this problem? Is there a cleaner way?

For reference I have also tried this solution, which looks really clean, to no avail.

Community
  • 1
  • 1
PlTaylor
  • 7,345
  • 11
  • 52
  • 94

1 Answers1

2

I would go one of these routes:

  • Generate interop dll with tlbimp, add it to your project and reference it directly:
    • In VS command prompt, execute tlbimp.exe <your_dll> to generate the interop dll. You can specify the name with /out option.
    • put this dll somewhere with your code
    • reference it by going to Add reference > Browse and click Browse... to add the dll
  • Generate the tlb from COM dll , add it to the project and reference the tlb:
    • Generate the tlb (e.g. using OLE/COM Object viewer) or extract it from the dll resources,
    • put this tlb somewhere with your code
    • reference it by going to Add reference > COM and click Browse... to add the tlb reference to project
    • As @HansPassant noted in comments, this solution still relies on registry, but you can register it with regtlb, regtlib or similar tool, as a prebuild step, which should be easier than installing the server (though if it is just a dll, you could use regsvr32 to register it instead of full install). However, this is still more complex than the approach with interop dll
Community
  • 1
  • 1
Zdeslav Vojkovic
  • 14,391
  • 32
  • 45
  • Can you provide some implementation details or links and say what the difference in the results are for those two methods? – PlTaylor Dec 18 '15 at 12:21
  • The second bullet doesn't address the problem, it still relies in the registry. First one is fine and the way you should do this. – Hans Passant Dec 18 '15 at 12:27