And*_*eff 8 windows-installer wix version
我用WiX创建了一个MSI文件.源WiX文件包含如下版本信息:
<Product Id="..."
Name="..."
Language="1033"
Version="1.0.0.1"
Manufacturer="..."
UpgradeCode="...">
Run Code Online (Sandbox Code Playgroud)
MSI文件似乎工作正常:它安装,卸载,升级时增加版本号等.
但是,当我尝试通过调用MsiGetFileVersion()API获取有关此文件的版本信息时,它返回错误1006(ERROR_FILE_INVALID文件不包含版本信息.)
因此我的问题是:如何(以编程方式,在C++中)检索MSI文件的版本号?或者,换句话说,在WiX文件中,版本信息应该通过MsiGetFileVersion()检索吗?
更多信息:Windows XP上的MSI 3.0和Vista上的MSI 4.0也会出现相同的错误.
作为参考,这是一个VBscript示例,我在构建过程中使用它来创建一个boostrapper之前抓取它.
Dim installer, database, view, result
Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase ("my.msi", 0)
Dim sumInfo : Set sumInfo = installer.SummaryInformation("my.msi", 0)
sPackageCode = sumInfo.Property(9) ' PID_REVNUMBER = 9, contains the package code.
WScript.Echo getproperty("ProductVersion")
WScript.Echo getproperty("ProductVersion")
WScript.Echo sPackageCode
WScript.Echo getproperty("ProductName")
Function getproperty(property)
Set view = database.OpenView ("SELECT Value FROM Property WHERE Property='" & property & "'")
view.Execute
Set result = view.Fetch
getproperty = result.StringData(1)
End Function
Run Code Online (Sandbox Code Playgroud)
为了完整起见,:: MsiGetFileVersion()是一个函数,它以与Windows Installer 相同的方式从PE文件(.exe或.dll)读取版本资源信息.这对于使用构建工具(例如WiX工具集)非常重要,因此它们可以正确填充File/@ Version信息.它不会从MSI中获取版本信息.由于@sascha显示您可以在Property表中查询"ProductVersion",或者您可以使用:: MsiGetProductProperty()来执行相同操作.
归档时间: |
|
查看次数: |
6880 次 |
最近记录: |