我有一个wix安装项目,实际上我需要检查是否安装了同一应用程序的其他任何版本,如果是这样,请在继续安装新版本之前显示一个带有卸载按钮的对话框以将其卸载。我没有怎么做。
我尝试了自定义操作项目,但没有工作。
Product.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="ee991ae8-eaf0-4534-a1ca-1925a65f722f" Name="SensorViewInstallSupport" Language="1033" Version="1.0.0.0"
Manufacturer="Acuity Brands, Inc." UpgradeCode="8965246e-67f7-41fa-b887-3cb73d479f47">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Media Id="1" Cabinet="SensorView.cab" EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed." Schedule="afterInstallValidate" >
</MajorUpgrade>
<!-- * Variables -->
<!-- Configurable install location -->
<PropertyRef Id="NETFRAMEWORK30_SP_LEVEL" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<Condition Message="This $(var.ProductName) requires .NET Framework 3.0 or higher has to be installed. Please install the .NET Framework then run this installer again.">
Installed Or NETFRAMEWORK30
</Condition>
<Feature Id="ProductFeature" Title="SensorView.WixSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<!-- Creating directories -->
<!--<Fragment>-->
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- Install website into program files folder. -->
<Directory Id="ProgramFilesFolder">
<!-- In program files create folder with name SensorView Installer. -->
<Directory Id="INSTALLFOLDER" Name="SensorView Installer" />
<!-- This is the folder where the website content will be located -->
<Directory Id="[Website]" Name="SensorView Installer" />
<!-- Continue in DirectoryRef with specific name -->
</Directory>
<!-- Here you can add another directories -->
</Directory>
<!--</Fragment>
<Fragment>-->
<!-- Complete feature which will be installed. -->
<Feature Id="Complete"
Title="Sensor View"
Level="1"
Display="expand"
ConfigurableDirectory="INSTALLLOCATION">
<!-- Main content of the Complete feature. -->
<Feature Id="MainContent"
Title="SensorView Website"
Description="The website content"
Level="1">
<!-- Include IIS Configuration. -->
<ComponentGroupRef Id="SensorViewIssConfiguration" />
<!-- Include web content. -->
<ComponentGroupRef Id="SensorViewWebComponents" />
<!-- Perform changes in the web.config file. -->
<ComponentRef Id="WebConfigCmp" />
</Feature>
</Feature>
<DirectoryRef Id="MYWEBWEBSITE">
<!-- Component handling the web.config -->
<Component Id="WebConfigCmp" Guid="">
<!-- Copy web.config to SENSORVIEWWEBSITE folder. -->
<File Id="WebConfigFile" KeyPath="yes"
Source="$(var.publishDir)\Web.config" Vital="yes" />
<util:XmlFile Id="ModifyConnectionString"
Action="setValue"
Permanent="yes"
ElementPath="/configuration/connectionStrings/
add[\[]@name='MyConnectionString'[\]]"
Name="connectionString"
File="[#WebConfigFile]"
Value="[CONNECTION_STRING]"
SelectionLanguage="XSLPattern"
Sequence="1" />
</Component>
</DirectoryRef>
<!-- .NET Framework 3.0 SP 1 must be installed -->
<Property Id="FRAMEWORKBASEPATH">
<RegistrySearch Id="FindFrameworkDir" Root="HKLM"
Key="SOFTWARE\Microsoft\.NETFramework"
Name="InstallRoot" Type="raw"/>
</Property>
<Property Id="ASPNETREGIIS" >
<DirectorySearch Path="[FRAMEWORKBASEPATH]"
Depth="4" Id="FindAspNetRegIis">
<FileSearch Name="aspnet_regiis.exe" MinVersion="2.0.5"/>
</DirectorySearch>
</Property>
<!-- Switch ASP.NET to version 2.0 -->
<CustomAction Id="MakeWepApp20" Directory="SENSORVIEW"
ExeCommand="[ASPNETREGIIS] -norestart -s W3SVC/1/ROOT/[SENSORVIEW]"
Return="check"/>
<!-- Ask user to uninstall with yes or no buttons -->
<CustomAction Id='CustomActionUninstall' BinaryKey='CustomActionUninstall' DllEntry='UninstallWarning' Execute='immediate' Return='check' />
<InstallExecuteSequence>
<Custom Action='CustomActionUninstall' Before='FindRelatedProducts'>NOT UPGRADINGPRODUCTCODE AND REMOVE~="ALL"</Custom>
<Custom Action="MakeWepApp20" After="InstallFinalize">
ASPNETREGIIS AND NOT Installed
</Custom>
</InstallExecuteSequence>
<!-- License and images -->
<WixVariable Id="WixUILicenseRtf" Value="$(var.MyWebResourceDir)\License.rtf" />
<!-- Specify UI -->
<UIRef Id="MyWebUI" />
<!--</Fragment>-->
<!--<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
-->
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!--
-->
<!-- <Component Id="ProductComponent"> -->
<!--
-->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!--
-->
<!-- </Component> -->
<!--
</ComponentGroup>
</Fragment>-->
</Product>
</Wix>
建议我如何实现相同目标。