I have a task that will determine the registered path of a type library from the CLSID, I'd be glad to donate the code.  I've kept it as a separate task but it could be integrated into tlbimp as well.  Actually, there's an easier (once you figure out the p/Invoke signature) method to do what Twan outlined here.

 

-----Original Message-----

Hello all,

I would like to see an addition for the tlbimp task:
In a Visual Studio .NET, the project file only states the clsid and version number of the dll you want to Interop. As the specific dll on the build box does not have to be in the same place as on the developer's box, it would be nice to have the tlbimp task do a lookup of the dll location via the clsid...

Example:

using System;
using Microsoft.Win32;

namespace DynamicLinkLibraryLocator {
  class Class1 {
    // CLSID like: {783CD4E4-9D54-11CF-B8EE-00608CC9A71F}
    string GetDLLLocation(string CLSID) {
    RegistryKey CLSIDKey = Registry.ClassesRoot.OpenSubKey("CLSID");
    RegistryKey ClassKey = CLSIDKey.OpenSubKey(CLSID);
    RegistryKey InprocServer32Key = ClassKey.OpenSubKey("InprocServer32");
    return (string) InprocServer32Key.GetValue("");
  }
}

Greetings, Twan Jacobs



Disclaimer http://www.infosupport.com
***********************************************************************
This E-Mail Message is intended exclusively for the addressee. If the
E-Mail was sent to you in error, please notify the sender immediately
by replying to this E-mail. We would then request you to destroy the
E-Mail and neither to use nor disclose the contents in any manner to
third parties, as the message could contain confidential information
which may be protected by the professional secrecy act.

This footnote also confirms that this E-mail message has been swept for
computer viruses.
***********************************************************************

Reply via email to