14

I'm unable to add reference to 'Microsoft Windows Installer Object Library' with VS2012. Any ideas, what could cause this issue?

When I try to create reference to the COM component, I get this error message "a reference to 'Microsoft Windows Installer Object Library' could not be added".

The VS project is basic class library (c# x86).

RandomBug
  • 186
  • 1
  • 7
  • Which is the framework? is it in 4.5? try it in 4.0? I tried to add the same to class Library in .Net 4.0 VS 2010 – Akshay Joy May 15 '13 at 06:22
  • The Framework is .NET 4.0 Client Profile. I also tried to add it to .NET 4.0 Full with the same results. – RandomBug May 15 '13 at 06:41
  • 1
    Use .Net 4.0 Full Profile, but I tried with the both the Profile, It work fine, Any way you are using .Net 4.0, Do u have VS 2010, can u just try , let me know whether its solves the Issue,because am using .Net 4.0 VS 2010, I didn't get any Issue.? – Akshay Joy May 15 '13 at 07:03
  • It didn't solve the issue. I just get another error message "Library not registered". I think I need to find another way to check the MSI version, because I can not trust that MSI.dll is registered correctly in target environment. – RandomBug May 15 '13 at 07:27

2 Answers2

27

In Visual Studio go to References > Add Reference... > COM > Browse... > %WINDIR%\system32\msi.dll.

Worked for me on VS2012.

Wernight
  • 36,122
  • 25
  • 118
  • 131
  • 1
    Work on VS2013 also. I posted a sample here: https://github.com/JohanPGunnarsson/GetParameterInfoFromMSI, which reads parameters from MSIs, like "ProductVersion". It references msi.dll from System32. – Mosca Pt Sep 30 '16 at 18:53
  • Does not work on 2017 for me at all. Same damn error. – Nathan McKaskle Jan 16 '19 at 18:52
-3

Check ur Regedit , Please check these Values

HKEY_CLASSES_ROOT\TypeLib\{000C1092-0000-0000-C000-000000000046}\1.0

If Visual Studio 2010 Installed

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\ComponentPickerPages\Recent\{9A341D96-5A64-11D3-BFF9-00C04F990235}\1

If Visual Studio 2008 Installed

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\ComponentPickerPages\Recent\{9A341D96-5A64-11D3-BFF9-00C04F990235}\1
Akshay Joy
  • 1,765
  • 1
  • 14
  • 23