Yes, you can use the Windows Installer Object Model to either, get a list of installed applications and their versions, or use it to open a built .MSI file and extract the Version from it.
I am interested in the version of the built .MSI from a setup project. I need to get the version from code in c# on the time when the setup is installed.
Get the version of setup
Craig N
Can you help clarify what you mean < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Are you interested in the ClickOnce publish version
Are you interested in the version of the Bootstrapper (setup.exe)
Are you interested in the version of the built .MSI from a setup project
How do you want to get this version Manually, from code within Visual Studio, from code that runs outside Visual Studio
Ken Shook
Hi,
I want version of setup after install.
May be can I do this by API of windows
Thank's
Alexei
Erik Casta&#241;eda
Yes, you can use the Windows Installer Object Model to either, get a list of installed applications and their versions, or use it to open a built .MSI file and extract the Version from it.
Fonzy
This walkthrough provides a sample of how to pass data to a Custom Action. You can pass the ProductVersion property instead.
mrmrmax
Hi,
Can you give me example of using Windows Installer Object Model
Thank's
Alexei
Montty
Hi,
I am interested in the version of the built .MSI from a setup project.
I need to get the version from code in c# on the time when the setup is installed.
Thank's
Alexei
wbkayani
Hi,
I have found how to use this objects:
Code in function:
WindowsInstaller.Installer installer = new WindowsInstallerClass() as Installer;
string pname, ver;
foreach(string prod in installer.Products)
{
try
{
pname = installer.get_ProductInfo (prod, "InstalledProductName");
if (pname.Trim().ToLower().Equals(ClsConfig.getAppConfigS("Title").Trim().ToLower()))
{
ver = installer.get_ProductInfo (prod, "VersionString");
this.lblApp.Text = this.lblApp.Text + " (" + ver + ")";
}
}
catch
{
}
}
installer = null;
----
Code of class:
[ComImport, Guid("000c1090-0000-0000-c000-000000000046")]
internal class WindowsInstallerClass{}-----
using
WindowsInstaller;(Add refence to MSI.DLL)
Thank's
Alexei