我遇到了Wix安装程序的问题,不知道具体到底是什么。 我已启用该对话框,允许用户在默认的
上选择自己的安装文件夹如果我运行安装并保留默认的“Program Files \ MyApp”,则应用程序安装没有问题。如果我然后卸载,所有文件和文件夹都会被正确删除。
如果我运行安装并将默认设置更改为c:\ TestFolder \ MyApp,它会对该位置安装没有问题,并包含具有相应内容的Java64bit和Java64bit / lib文件夹的子文件夹。
然后,如果我立即进行卸载,它会完全正确地删除Java内容,但会将所有文件保留在c:\ TestFolder \ MyApp根目录中。
安装后查看注册表,它会显示正确的安装目录位置。我还能提供什么来帮助解决这个问题。
这是完整的(删除了GUID)安装不同的文件
主要(样本)产品的文件
<?xml version="1.0" encoding="utf-32BE"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Name="AMyApp"
Manufacturer="Testing"
Language="1033"
Version="1.0.1.0"
Id="*"
UpgradeCode="{GUID1}" >
<?include AMyApp_Define_Paths.wxi ?>
<Package
Id="*"
InstallerVersion="200"
Platform="x64"
Compressed="yes"
Languages="1033"
SummaryCodepage="1252"
Comments="AMyApp Package Comments area"
Description ="AMyApp"
InstallScope="perMachine" />
<MajorUpgrade
AllowDowngrades="no"
AllowSameVersionUpgrades="yes"
DowngradeErrorMessage="A newer version of AMyApp is already installed." />
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="{GUID1}">
<UpgradeVersion
Minimum="4.0.0.0" Maximum="99.0.0.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<Media Id="1"
Cabinet="AMyApp.cab"
EmbedCab="yes" />
<WixVariable Id="ALLUSERS" Value="2" />
<WixVariable Id="MSIINSTALLPERUSER" Value="" />
<!-- see if location from a previously installed instance. -->
<Property Id="INSTALLDIR" >
<RegistrySearch Id="AMYAPP" Type="raw"
Root="HKLM" Key="SOFTWARE\AMYAPP" Name="InstallDir" />
</Property>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<!-- Search registry for previous installed location -->
<Property Id="PREVIOUSINSTALLFOLDER">
<RegistrySearch Id="GetPreviousInstallFolder" Root="HKLM"
Key="SOFTWARE\AMYAPP" Name="INSTALLDIR" Type="raw" />
</Property>
<CustomAction Id="SetINSTALLDIR" Property="INSTALLDIR"
Value="[PREVIOUSINSTALLFOLDER]" Execute="firstSequence" />
<CustomAction Id="SetWIXUI_INSTALLDIR" Property="WIXUI_INSTALLDIR"
Value="[PREVIOUSINSTALLFOLDER]" Execute="firstSequence" />
<InstallExecuteSequence>
<Custom Action="SetINSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
<Custom Action="SetWIXUI_INSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action="SetINSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
<Custom Action="SetWIXUI_INSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
</InstallUISequence>
<Directory Id="TARGETDIR" Name="SourceDir" >
<!-- The directories "DesktopFolder", "FontsFolder", "ProgramFilesFolder"
are all pre-defined common names via the installer and reference the
actual windows locations respectively -->
<Directory Id="DesktopFolder" />
<Directory Id="FontsFolder" />
<Directory Id="ProgramFiles64Folder" >
<!-- The "ID" is the name internally that refers to the folder when
trying to install files, etc... the "Name" is what the actual name
will be at actual install time as viewed by Windows Explorer -->
<Directory Id="INSTALLDIR" Name="AMYAPP" >
<Component Id="C_HKLM_AMyAppUsage" Guid="{GUID2}">
<RegistryKey Root="HKLM" Key="SOFTWARE\AMyApp" >
<RegistryValue Name="IsSomeKey" Type="string" Value="YES" KeyPath="yes" />
</RegistryKey>
</Component>
<Directory Id="Java64BitDIR" Name="Java64Bit" >
<Directory Id="Java64BitLibDIR" Name="Lib" />
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="AMyApp_Features"
Title="AMyApp (Wix Testing)"
Level="1"
ConfigurableDirectory="INSTALLDIR" >
<ComponentRef Id="C_HKLM_AMyAppUsage" />
<ComponentRef Id="AMyApp_CORE" />
<ComponentRef Id="AMyApp_Shortcuts" />
<ComponentRef Id="JAVA64BIT_Support" />
<ComponentRef Id="JAVA64BITLIB_Support" />
</Feature>
<UI>
<UIRef Id="WixUI_InstallDir" />
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Next"
Event="NewDialog"
Value="VerifyReadyDlg"
Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
</UI>
<Property Id="LAUNCHAPPONEXIT" Value="1" />
</Product>
</Wix>
Java子文件夹示例的片段文件
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<?include AMyApp_Define_Paths.wxi ?>
<DirectoryRef Id="Java64BitDIR">
<Component Id="JAVA64BIT_Support" Guid="{GUID1a}">
<File Id="_64_javax.comm.properties" Source="$(var.Path_Java64Bit)\javax.comm.properties" />
</Component>
</DirectoryRef>
<DirectoryRef Id="Java64BitLibDIR">
<Component Id="JAVA64BITLIB_Support" Guid="{GUID2a}">
<File Id="_64_HardwireDriver.jar" Source="$(var.Path_Java64BitLib)\HardwireDriver.jar" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
根文件夹中安装的常用内容的片段文件
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" >
<Fragment>
<DirectoryRef Id="INSTALLDIR">
<Component Id="AMyApp_CORE" Guid="{GUID1c}" Win64="yes">
<?include AMyApp_Define_Paths.wxi ?>
<RegistryKey
Root="HKLM"
Key="SOFTWARE\AMyApp"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes" >
<RegistryValue Type="string" Name="InstallDir" Value="[INSTALLDIR]"/>
<RegistryValue Type="string" Name="MyAppContext" Value="Testing"/>
</RegistryKey>
<RemoveFile Id="RemoveAllMyAppFiles" Name="*.*" On="uninstall" />
<RemoveFolder Id="INSTALLDIR" On="uninstall" />
<File Id="MyApp.exe" Source="$(var.Path_MyAppReleaseFolder)\MyApp.exe" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
答案 0 :(得分:1)
这是我想出的一个简化的解决方法,但不知道它为什么会做它在幕后做的事情,但是有效。
在宣布<UI>
段时,我刚刚更改了&#34;欢迎&#34;和#34; MaintenanceWelcome&#34;两个对话框都转到&#34;安装目录&#34;对话。它显然绕过了#34; Repair&#34; /&#34;卸载&#34;但是会允许安装程序自己删除原始文件并从安装程序重新发布新文件。
<UI>
<UIRef Id="WixUI_InstallDir" />
<!--<Property Id="WixUI_Mode" Value="InstallDir" />-->
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<!-- Send the MAINTENANCE Dialog to the same Install Dir dialog -->
<Publish Dialog="MaintenanceWelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
...
</UI>