2017-08-15 158 views
2

我有這個Wix XML腳本來在桌面上安裝我的服務和快捷方式圖標。安裝完美,卸載程序也可以工作,但它會在桌面上留下快捷方式圖標。我無法弄清楚什麼是錯的,我作爲維克斯文件中指定的On="uninstall"參數,卸載後桌面圖標不會被刪除 - Wix

這裏的XML:

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> 
<Product Id="*" Name="Administration Service" Language="1033" Version="1.3.0.0" Manufacturer="company" UpgradeCode="PUT-GUID-HERE> 
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64"/> 

    <Icon Id="shortcut_s.url" SourceFile="./../ReviewerBootstrapper/reviewer.ico"/> 
    <Property Id="ARPPRODUCTION" Value="shortcut_s.url"/> 
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> 
    <Media Id="1" Cabinet="cab1.cab" EmbedCab="yes" /> 

    <Feature Id="ProductFeature" Title="AdministrationServiceInstallation" Level="1"> 
      <ComponentGroupRef Id="ProductComponents" /> 
      <ComponentGroupRef Id="AdministrationServiceComponents" /> 
      <ComponentRef Id="ApplicationShortcut" /> 
      <ComponentRef Id="ApplicationShortcutDesktop"/> 
    </Feature> 

    </Product> 


    <Fragment> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="ProgramFiles64Folder"> 
     <Directory Id="Company" Name="Eurotherm"> 
      <Directory Id="App" Name="Reviewer"> 
      <Directory Id="INSTALLFOLDER" Name="AdministrationService" >  
      </Directory> 
      </Directory> 
     </Directory> 
     </Directory> 
      <Directory Id="ProgramMenuFolder"> 
       <Directory Id="ApplicationProgramsFolder" Name="Eurotherm Reviewer" /> 
      </Directory> 
      <Directory Id="DesktopFolder" Name="Desktop" /> 
    </Directory> 
</Fragment> 

    <Fragment> 
    <DirectoryRef Id="ApplicationProgramsFolder"> 
     <Component Id="ApplicationShortcut" Guid="*" Win64="yes"> 
     <Shortcut Id="ApplicationStartMenuShortcut" 
        Name="Reviewer Services" 
        Target="[INSTALLFOLDER]shortcut_s.url" 
        WorkingDirectory="APPLICATIONROOTDIRECTORY" 
        Icon="shortcut_s.url" /> 
     <RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall" /> 
     <RegistryValue Root="HKCU" Key="Software\Microsoft\Reviewer" Name="installed" Type="integer" Value="1" 
         KeyPath="yes" /> 
     </Component> 
    </DirectoryRef> 
    <DirectoryRef Id="DesktopFolder"> 
     <Component Id="ApplicationShortcutDesktop" Guid="*" Win64="yes"> 
     <Shortcut Id="DesktopShortcut" 
        Name="Services Reviewer" 
        Target="[INSTALLFOLDER]shortcut_s.url" 
        WorkingDirectory="APPLICATIONROOTDIRECTORY" 
        Icon="shortcut_s.url" /> 
     <RemoveFolder Id="RemoveDesktopShortCut" Directory="DesktopFolder" On="uninstall" /> 
     <RegistryValue Root="HKCU" Key="Software\Microsoft\Reviewer" Name="installed" Type="integer" Value="1" 
         KeyPath="yes" /> 
     </Component> 
    </DirectoryRef> 
    </Fragment> 






<Fragment> 
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 

      <Component Id="WebShortcut" Guid="" Win64="yes"> 
       <File Id="web_shortcut_id" Name="shortcut_s.url" Source="shortcut_s.url"/> 
      </Component>  

     <Component Id="removeAll" Guid="*" Win64="yes"> 
     <CreateFolder /> 
     <util:RemoveFolderEx Id="RemoveAdministrationServicesFolder" On="uninstall" Property="INSTALLFOLDER" /> 
    </Component> 
      <Component Id="ReviewerServices.web.exe" Guid="*" Win64="yes"> 
      <File Id="ReviewerServices.web.exe" KeyPath="yes" Source="$(var.publishDir)\ReviewerServices.web.exe" /> 
        <ServiceInstall Id="AdministrationServiceInstaller" 
              Type="ownProcess" 
              Vital="yes" 
              Name="ReviewerServices.web" 
              DisplayName="Reviewer Administration Service" 
              Description="ReviewerAdministrationService" 
              Start="auto" 
              Account="LocalSystem" 
              ErrorControl="ignore" 
              Interactive="no" /> 
        <ServiceControl Id="AdministrationStartService" 
              Start="install" 
              Stop="both" 
              Remove="uninstall" 
              Name="ReviewerServices.web" 
              Wait="yes" /> 
      </Component> 
    </ComponentGroup> 
</Fragment> 
</Wix> 

回答

2

除了使用DirectoryRef標籤指示的目的地,可以指定它在Shortcut標籤的Directory值中,如下所示。請注意,我刪除了周圍的DirectoryRef標籤。

<Component Id="ApplicationShortcutDesktop" Guid="*" Win64="yes"> 
    <Shortcut Id="DesktopShortcut" 
       Name="Services Reviewer" 
       Directory="DesktopFolder" 
       Target="[INSTALLFOLDER]shortcut_s.url" 
       WorkingDirectory="APPLICATIONROOTDIRECTORY" 
       Icon="shortcut_s.url" /> 
    <RegistryValue Root="HKCU" Key="Software\Microsoft\Reviewer" Name="installed" Type="integer" Value="1" 
        KeyPath="yes" /> 
</Component> 

您使用的RemoveFolder將指定在卸載時應刪除桌面文件夾,這是不可能的。

相關問題