How to check COM dll is registered or not with C#?

前端 未结 6 1060
情歌与酒
情歌与酒 2020-12-06 17:59

I need to check if msdia100.dll is registered on a computer system that I\'m running in order to register the dll with the command regsvr32.exe. How can I do th

6条回答
  •  一个人的身影
    2020-12-06 18:44

    Verify if key exists using Microsoft.Win32.RegistryKey

    var key = Microsoft.Win32.RegistryKey.OpenBaseKey(
                Microsoft.Win32.RegistryHive.ClassesRoot,
                Microsoft.Win32.RegistryView.Default)
                .OpenSubKey("Interface")
                   //replace with your COM object GUID
                .OpenSubKey("{a3560000-0000-0000-c63b3-000000cbadf0000}");
    
            return key != null;
    

提交回复
热议问题