I was trying to use windows api to find out the version info of an installed application.
I used the upgrade code to find out the product code using MsiEnumRelatedProduc
In response to @JoshHetland the string to pass is the CamelCase postfix of the INSTALLPROPERTY_VERSIONSTRING
- remember that MSI is case sensitive.
So:
INSTALLPROPERTY_VERSIONSTRING
becomes VersionString
INSTALLPROPERTY_INSTALLDATE
becomes InstallDate
and so on.
Complete list of properties available is on the MSDN page for the MsiGetProductInfo function .
Application.ProductVersion works for me, no need to call WinAPI manually (I am still in .Net 1.1 though)
Here is what I did that my solved my problem.
Int32 m_len = 11512;
StringBuilder m_versionInfo = new StringBuilder(m_len);
StringBuilder m_sbProductCode = GetProductCodeFromMsiUpgradeCode();
MsiGetProductInfo(m_sbProductCode.ToString(), "**VersionString**", m_versionInfo, ref m_len);
return m_versionInfo.ToString();
This did return me the version string ,and also converted from decimal into string format like 1.4.3.