我正在尝试使用WiX创建安装程序。我的问题是,仅当尚未安装第三方软件或该软件的版本早于所包含软件的当前版本时,才必须安装该第三方软件。请参阅下面的示例。另外,如果您给我有关此第三方软件的一些建议,也将非常好。如果它被另一个程序使用或者只是永久保存,如何防止它被卸载?
我不想使用注册表搜索。我要添加的软件是Dokan驱动程序。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="MyApp" Version="1.2.0.0" Manufacturer="Me"
UpgradeCode="{GUID}" IconSourceFile="..\icon.ico">
<BootstrapperApplicationRef
Id="WixStandardBootstrapperApplication.RtfLicense" >
<bal:WixStandardBootstrapperApplication
LogoFile="..\lo64.png" LicenseFile="License.rtf"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx45Web"/>
<ExePackage
SourceFile="..\ThirdPartySoftware_0.6.0.exe"
Permanent="yes"
InstallCondition="NOT Installed"/>
<MsiPackage SourceFile="..\MyApp.msi"/>
</Chain>
</Bundle>
</Wix>
Run Code Online (Sandbox Code Playgroud)
通过此编辑,我现在有了安装程序,该程序可以检查是否已安装Dokan,是否已安装。
我尝试检查版本,但文件未版本化,这给了我NULL异常。
<util:FileSearch
Id="CheckDokan"
Path="[ProgramFilesFolder]Dokan\DokanLibrary\dokanctl.exe"
Variable="Dokan"
Result="exists"/>
<Chain>
<PackageGroupRef Id="NetFx45Web"/>
<ExePackage
SourceFile="Dokan.exe"
Permanent="yes"
InstallCommand="/q"
DetectCondition='Dokan'/>
<MsiPackage SourceFile="MyApp.msi"/>
</Chain>
Run Code Online (Sandbox Code Playgroud)
我可以说@Yawar帮助了我。
方法1
您可以使用文件搜索
<util:FileSearch
Id="CheckFile"
Path="[CommonAppDataFolder]thirdpartapp\thirdparty.dll"
Variable="THIRDPARTYFILE"
Result="version" />
Run Code Online (Sandbox Code Playgroud)
您可以通过以下方式检查Adobe Air
<util:FileSearch
Id="CheckAir"
Path="[CommonFilesFolder]\Adobe AIR\Versions\1.0\Adobe AIR.dll"
Variable="ADOBEAIRFILE"
Result="version" />
Run Code Online (Sandbox Code Playgroud)
然后在检测条件时使用此变量
DetectCondition='NOT Installed AND ADOBEAIRFILE>=v2.6.0'
Run Code Online (Sandbox Code Playgroud)
希望对您有所帮助:)
方法二:
如果找不到版本,请使用它
<util:FileSearch
Id="CheckFile"
Path="[CommonAppDataFolder]thirdpartapp\thirdparty.dll"
Variable="THIRDPARTYFILE"
Result="exists" />
Run Code Online (Sandbox Code Playgroud)
然后修改检测条件
DetectCondition='THIRDPARTYFILE'
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请遵循文档 。http://wixtoolset.org/documentation/manual/v3/xsd/util/filesearch.html
| 归档时间: |
|
| 查看次数: |
3676 次 |
| 最近记录: |