1

我正在使用 WIX 打包一个 MSI。二进制文件需要安装在 UNC 驱动器 (\share\xxxz\east) 上。安装工作正常,二进制文件安装在 UNC 上,但在卸载过程中出现以下错误。

“安装程序在安装软件包时遇到了意外错误。这可能表明此软件包有问题。错误代码是 2343。”

让我发疯的是为什么安装有效而卸载失败!

下面是我的 wix 脚本的样子......

<?xml version="1.0" encoding="UTF-8"?>

<!-- Create the package per machine and not per user -->
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />    

<!-- Package the binaries in the msi -->
<Media Id="1" Cabinet="CABIIS.cab" EmbedCab="yes" />

<!-- Default the asp.net framework to 4.0 -->
<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="4.0.3"/>
  </DirectorySearch>
</Property>
<CustomAction Id="WebAppIISVersionSetup" Directory="TARGETDIR" ExeCommand="[ASPNETREGIIS] -norestart -ir" Return="check"/>
<InstallExecuteSequence>
  <Custom Action="WebAppIISVersionSetup" After="InstallFinalize">ASPNETREGIIS AND NOT Installed</Custom>
  <Custom Action="**SetInstallLocationRootDirectory**" After="CostFinalize"  />
</InstallExecuteSequence>

<!-- Set the install location from the trigger file -->
<CustomAction
  Id="SetInstallLocationRootDirectory"
  Directory="INSTALLLOCATION"
  Value="[TARGET.INSTALLLOCATION]" />

<!-- Properties & Variables -->
<WixVariable Id="WixUIBannerBmp" Value="Resources/CeLogo.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="Resources/MidstreamChangeTeam.bmp" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<Property Id="CALCULATION.SERVICE.USERNAME" Value="xx\"/>
<Property Id="CALCULATION.SERVICE.PASSWORD" Hidden="yes" />

<!-- The directory structure for installation -->
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="INSTALLLOCATION" Name="East">        
    <Directory Id="WEBSITESFOLDER" Name="Website" >
      <Directory Id="EASTROOTFOLDER" Name="EastRoot"  />
      <Directory Id="WCFCALCULATIONFOLDER" Name="CalculationService" />
    </Directory>
    <Directory Id="LOGFOLDER" Name="Log"/>
  </Directory>
</Directory>

<!-- The features in the product -->
<Feature Id="ProductFeature" Title="East Components" Level="1">
  <ComponentGroupRef Id="CalculationServiceComponents" />
</Feature>

<!-- Create a UI for the installer -->
<UI Id="EAST_InstallUI">
  <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
  <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
  <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

  <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
  <Property Id="WixUI_Mode" Value="InstallDir" />

  <DialogRef Id="BrowseDlg" />
  <DialogRef Id="DiskCostDlg" />
  <DialogRef Id="ErrorDlg" />
  <DialogRef Id="FatalError" />
  <DialogRef Id="FilesInUse" />
  <DialogRef Id="MsiRMFilesInUse" />
  <DialogRef Id="PrepareDlg" />
  <DialogRef Id="ProgressDlg" />
  <DialogRef Id="ResumeDlg" />
  <DialogRef Id="UserExit" />

  <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
  <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>

  <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

  <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>

  <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
  <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
  <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
  <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
  <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="ServiceIdentityDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
  <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
  <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

  <Publish Dialog="ServiceIdentityDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" >1</Publish>
  <Publish Dialog="ServiceIdentityDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>

  <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServiceIdentityDlg" Order="1">NOT Installed</Publish>
  <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

  <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

  <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>

  <!--<Dialog Id="DatabaseDlg" Title="!(loc.DatabaseDlg_Title)" X="50" Y="50" Width="370" Height="270">
    <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="369" Height="44" Text="WixUI_Bmp_Banner" Disabled="yes" />
    <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DatabaseDlgTitle)" />
    <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DatabaseDlgDescription)" />
    <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="373" Height="0" Disabled="yes" />
    <Control Id="BottomLine" Disabled="yes" Height="1" Type="Line" Width="370" X="0" Y="234" />
    -->
  <!--<Control Id="DatabaseServerLabel" Text="!(loc.DatabaseServerLabel)" Type="Text" Width="100" Height="18" X="20" Y="102" />
    <Control Id="DatabaseServer" Type="Edit" X="130" Y="100" Width="120" Height="18" Property="DB.SERVER" />
    <Control Id="DatabaseDlgText" Text="!(loc.DatabaseDlgText)" Type="Text" Width="330" Height="30" X="20" Y="60" />-->
  <!--
    <Control Id="LogFileLabel" Text="!(loc.LogFileNameLabel)" Type="Text" Width="100" Height="18" X="20" Y="137" />
    <Control Id="LogFileName" Type="Edit" X="130" Y="135" Width="120" Height="18" Property="LOGFOLDER" />
    -->
  <!--<Control Id="UnprocessedFileLocationLabel" Text="!(loc.UnprocessedFileLocationNameLabel)" Type="Text" Width="100" Height="18" X="20" Y="172" />
    <Control Id="UnprocessedFileLocationName" Type="Edit" X="130" Y="170" Width="120" Height="18" Property="UNPROCESSEDFILELOCATION" />-->
  <!--
    <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
    <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="!(loc.WixUINext)" Disabled="no" Default="yes" >
    </Control>
    <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Text="!(loc.WixUICancel)" Cancel="yes">
      <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
    </Control>
  </Dialog>-->

  <Dialog Id="InvalidUsernamePasswordDlg" Y="10" Width="260" Height="85" Title="!(loc.InvalidUsernamePasswordDlg_Title)">
    <Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30" Text="!(loc.InvalidUsernamePasswordDlgText)" />
    <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="!(loc.ErrorDlgErrorIconTooltip)" FixedSize="yes" IconSize="32" Text="!(loc.CancelDlgIcon)" />
    <Control Id="Ok" Type="PushButton" X="105" Y="57" Width="50" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIOK)">
      <Publish Event="EndDialog" Value="Return">1</Publish>
    </Control>
  </Dialog>

  <Dialog Id="ServiceIdentityDlg" Title="!(loc.ServiceIdentityDlg_Title)" X="50" Y="50" Width="370" Height="270">
    <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="369" Height="44" Text="!(loc.SetupTypeDlgBannerBitmap)" Disabled="yes" />
    <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.ServiceIdentityDlgTitle)" />
    <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.ServiceIdentityDlgDescription)" />
    <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="373" Height="0" Disabled="yes" />
    <Control Id="BottomLine" Disabled="yes" Height="1" Type="Line" Width="370" X="0" Y="234" />
    <Control Id="UsernamePasswordText" Text="!(loc.UsernamePasswordText)" Type="Text" Width="330" Height="60" X="20" Y="60" />
    <Control Id="UsernameLabel" Text="!(loc.UsernameLabel)" Type="Text" Width="100" Height="18" X="20" Y="127" />
    <Control Id="ServiceIdentity" Type="Edit" X="130" Y="125" Width="120" Height="18" Property="CALCULATION.SERVICE.USERNAME" />
    <Control Id="PasswordLabel" Text="!(loc.PasswordLabel)" Type="Text" Width="100" Height="18" X="20" Y="162" />
    <Control Id="Password" Type="Edit" X="130" Y="160" Width="120" Height="18" Property="CALCULATION.SERVICE.PASSWORD" Password="yes" />
    <Control Id="PasswordCheckLabel" Text="!(loc.ConfirmPasswordLabel)" Type="Text" Width="100" Height="18" X="20" Y="192" />
    <Control Id="ConfirmPassword" Type="Edit" X="130" Y="190" Width="120" Height="18" Property="ConfirmPassword" Password="yes" />
    <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
    <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="!(loc.WixUINext)" Disabled="no" Default="yes" >
      <Publish Property="IsValidUser" Value="1">CALCULATION.SERVICE.USERNAME AND CALCULATION.SERVICE.PASSWORD AND CALCULATION.SERVICE.PASSWORD = ConfirmPassword</Publish>
      <Publish Property="IsValidUser">NOT CALCULATION.SERVICE.USERNAME OR NOT CALCULATION.SERVICE.PASSWORD OR CALCULATION.SERVICE.PASSWORD &lt;&gt; ConfirmPassword</Publish>
      <Publish Event="SpawnDialog" Value="InvalidUsernamePasswordDlg">NOT IsValidUser</Publish>
    </Control>
    <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Text="!(loc.WixUICancel)" Cancel="yes">
      <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
    </Control>
  </Dialog>

  <Property Id="ARPNOMODIFY" Value="1" />

</UI>
<UIRef Id="WixUI_Common" />

我通过一个 cmd 文件触发安装,它看起来像......

msiexec.exe /i Ct.IIS.msi ^
TARGET.INSTALLLOCATION="\\share\xxxz\east\" ^
CALCULATION.SERVICE.USERNAME=".\xxx" ^
CALCULATION.SERVICE.PASSWORD="xxx" ^
/l* Ct.IIS.Install.log /q

有任何想法吗?

4

1 回答 1

2

下面的自定义操作也在卸载中运行。但是您不会在卸载时传递TARGET.INSTALLLOCATION属性值。所以这就是这里的问题。

<Custom Action="**SetInstallLocationRootDirectory**" After="CostFinalize"  />

修改此自定义操作以仅在安装中运行。

<Custom Action="**SetInstallLocationRootDirectory**" After="CostFinalize">Not Installed</Custom>

于 2013-04-26T05:51:28.457 回答