Family Tree Mike avait prétendu :
By using CreateInstance or CreateObject, you don't need to add a reference.
You should check for an exception when calling this to see if the class is
not registered, but I believe there will be a windows installer on every
machine.
"Alhambra Eidos Desarrollo" wrote:
>>
>>Type type = Type.GetType("Windows.Installer");
WindowsInstaller.Installer installer = Activator.CreateInstance(type);
thanks mister !!!
I need add some reference about Windows.Installer in my csproj ??? which
Reference, where the type WindowsInstaller.Installer contains within the
reference ?
How can I detect that Windows Installer is installed in my machine ??
Thanks again, mister.
You must add a reference to "C:\Windows\System32\msi.dll"
Here is the C# code reviewed :
Type type = Type.GetType("Windows.Installer");
WindowsInstaller.Installer installer = (WindowsInstaller.Installer)
Activator.CreateInstance(type);
foreach (string strProductCode in installer.Products)
{
Console.WriteLine(strProductCode);
string strProductName = installer.get_ProductInfo(strProductCode,
"InstalledProductName");
if (strProductName == "Something")
{
}
}
--
Paul Musso