簡體   English   中英

Wix設置-如何定義卸載

[英]Wix setup - How to define uninstall

我已經為我的C#項目創建了第一個Wix設置(我是wix的初學者)。

安裝程序創建一個msi文件,該文件運行良好。 設置后,所有DLL和.exe均在“ C:\\ Program Files(x86)\\ MyApplication”中創建

但是,當我右鍵單擊msi並選擇“卸載”時,將顯示一個沒有出現錯誤的卸載菜單,但未刪除文件夾“ C:\\ Program Files(x86)\\ MyApplication”。

如何定義卸載功能以刪除此文件夾?

我的Product.wxs有一部分

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="*"
           Name="My Application"
           Language="1033"
           Version="1.0.0.0"
           Manufacturer="Me"
           UpgradeCode="36944ae1-9e9f-4ef0-a860-9d894e0c28ef">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/>
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
    <Media Id="1" Cabinet="myApplication.cab" EmbedCab="yes"/>

    <Feature Id="ProductFeature" Title="My Application" Level="1">
      <ComponentGroupRef Id="ProductComponents"/>
      <ComponentRef Id ="ApplicationShortcut"/>
      <ComponentRef Id ="ApplicationShortcutDesk"/>
      <ComponentRef Id ="RemoveAll"/>
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramMenuFolder">
        <Directory Id="ApplicationProgramsFolder" Name="My Application"/>
      </Directory>
      <Directory Id="DesktopFolder" SourceName="Desktop"/>
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="My Application">
          <Directory Id="fr" Name="fr"/>

          <Component Id="RemoveAll" Guid="{63F6943C-7707-41CA-BAB9-7438471EC81E}">
            <RemoveFile Id="RemoveAllFilesOnUninstall" Directory="INSTALLFOLDER" Name ="*.*" On ="uninstall"/>
            <RemoveFolder Id="RemoveAllFoldersOnUninstall" Directory="INSTALLFOLDER" On="uninstall"/>
            <RegistryValue Root="HKLM" Key="Software\Microsoft\MyApplication" Name="Path" Type="string" Value="[INSTALLFOLDER]" KeyPath="yes" />
            <util:RemoveFolderEx On="uninstall" Property="INSTALLFOLDER" />
          </Component>
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <DirectoryRef Id="ApplicationProgramsFolder">
      <Component Id="ApplicationShortcut" Guid="{3B0B5064-807C-4E29-A701-E77BE8B8FA86}">
        <Shortcut Id="ApplicationStartMenuShortcut"
                  Name="My Application"
                  Target="[#MyApplication.exe]"
                  WorkingDirectory="INSTALLFOLDER"/>
        <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\Microsoft\MyApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </DirectoryRef>
    <DirectoryRef Id="DesktopFolder">
      <Component Id="ApplicationShortcutDesk" Guid="{61087C99-9CA8-4191-8251-219DFDAFC666}">
        <Shortcut Id="ApplicationStartDeskShortcut"
                  Name="My Application"
                  Target="[#MyApplication.exe]"
                  WorkingDirectory="INSTALLFOLDER"/>
        <RemoveFolder Id="DesktopFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\Microsoft\MyApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </DirectoryRef>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents">
      <Component Id="ProductComponent" Guid="{5C62E31A-C787-4B45-A4F7-2324A12C72D1}" Directory="INSTALLFOLDER">
        <!-- List of DLL/EXE -->
    </ComponentGroup>
  </Fragment>
</Wix>

編輯 :我現在正在使用UtilExtension並且現在已正確刪除INSTALLFOLDER 重命名的唯一元素是ApplicationShortcutDeskApplicationStartMenuShortcut RemoveFolder如何為快捷方式工作?

由於Sutamin Anton,我終於找到了問題所在。

我的GUID阻止了刪除(請參閱該帖子

有了新的GUID,一切都可以正常運行,而無需CustomAction / RemoveFile / etc ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM