我有这个 wxs 文件,预计它是:1)如果 env ZENWORKS_HOME 存在,它安装在那里,2)如果没有,它安装到 Program Files。
我面临的问题是:
a) 如果 ZENWORKS_HOME env 路径我更改,默认是C:\Program Files\Novell\ZENworks\bin\preboot
我更改为 D:\,msi 安装失败并出现错误代码
b) 如果我删除 ZENWORKS_HOME 环境变量,那么它也无法安装。
下面是我的 wxs 文件的代码片段:
<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
<!-- TODO: Create new GUIDs for the Product and Package Id. -->
<!-- TODO: Create a GUID for the UpgradeCode. This GUID must remain the same forever more
for your MSI...at least as long as you want the MSI engine to actually upgrade
between versions of your MSI -->
<!-- TODO: Fill out the Description field and the Product Name. -->
<Product UpgradeCode="5CB46018-7411-4049-BB2D-CF7414BC8618" Id="????????-????-????-????-????????????" Name="ZENworks Image Explorer" Language="1033" Version="$(var.version)" Manufacturer="Novell, Inc.">
<Package Id="????????-????-????-????-????????????" Description="ZENworks Image Explorer allows to you to view and modify the contents of a ZENworks image." InstallerVersion="200" Compressed="yes" />
<Condition Message="ZENworks Image Explorer requires that your computer is running Windows XP or Windows 2003 Server"><![CDATA[(Not Version9X) And (VersionNT > 500)]]></Condition>
<Media Id="1" Cabinet="Product.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLATIONDIRECTORY" Name="DefltDir">
<Directory Id="bin" Name="bin">
<Directory Id="preboot" Name="preboot">
<Component Id="ZMGEXP_Start_script" Guid="CC1958FD-E438-4C13-9C97-D0A629AFB6A4" DiskId="1">
<File Id="zmgexp.bat" LongName="zmgexp.bat" Name="ZMGEXP1.BAT" Source="zmgexp.bat" />
</Component>
<Directory Id="nls" Name="nls">
<Component Id="ZMGEXP_Help_files" Guid="F70E341C-2B27-4FED-B1DF-DC8C311FF322" DiskId="1">
<File Id="ImgExplorerHelp.html" Name="IMGEXPH1.htm" Source="resources\helpfiles\ImgExplorerHelp.html" LongName="ImgExplorerHelp.html" />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="lib" Name="lib">
<Directory Id="java" Name="java">
<Component Id="ZMGEXP_jar" Guid="B0F2E4AA-17AC-4B0A-8560-9DA8CE17790F" DiskId="1">
<File Id="zmgexp.jar" LongName="zmgexp.jar" Name="ZMGEXP1.JAR" Source="zmgexp.jar" />
</Component>
<Component Id="SWT_64_jar" Guid="51A737C4-F199-4366-A3A0-D374A7800A96" DiskId="1" Win64="yes">
<Condition>VersionNT64</Condition>
<File Id="swt_64.jar" LongName="swt.jar" Name="SWT_64.JAR" Source="swt-win64\swt.jar" />
</Component>
<Component Id="SWT_32_jar" Guid="9B01F63C-F125-4f6d-B729-A2CE6B303E35" DiskId="1" Win64="no">
<Condition>NOT VersionNT64</Condition>
<File Id="swt_32.jar" LongName="swt.jar" Name="SWT_32.JAR" Source="swt-win32\swt.jar" />
</Component>
.
.
.<snip>
<Upgrade Id="5CB46018-7411-4049-BB2D-CF7414BC8618">
<UpgradeVersion IgnoreRemoveFailure="yes" IncludeMaximum="yes" Maximum="$(var.version)" Property="UPGRADE_VERSIONS"/>
<UpgradeVersion OnlyDetect="yes" IgnoreRemoveFailure="yes" IncludeMinimum="no" Minimum="$(var.version)" Property="NEWER_VERSIONS"/>
</Upgrade>
<Property Id="UPGRADE_VERSIONS" Secure="yes"/>
<Property Id="NEWER_VERSIONS" Secure="yes"/>
<CustomAction Id="SetInstallationDirectory"
Directory="INSTALLATIONDIRECTORY"
Value="[%ZENWORKS_HOME]" />
<CustomAction Id="NEWER_VERSION_PRESENT" Error="A newer version already exists"/>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallFinalize"/>
<Custom Action="NEWER_VERSION_PRESENT" After="FindRelatedProducts">
NEWER_VERSIONS
</Custom>
<Custom Action="SetInstallationDirectory" After='CostFinalize'>[%ZENWORKS_HOME%]</Custom>
</InstallExecuteSequence>
</Product>
</Wix>