Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WiX卸载不会卸载任何内容_Wix_Installation_Components_Uninstallation - Fatal编程技术网

WiX卸载不会卸载任何内容

WiX卸载不会卸载任何内容,wix,installation,components,uninstallation,Wix,Installation,Components,Uninstallation,我对使用WiX是新手,我创建了一个简单的perUser应用程序安装,其中包含一些文件、一些注册表项和一个文件关联。我用UID把所有东西都放到组件中。安装过程工作得很好 我读了很多关于如何定义什么以及如何卸载这些组件的书,但是在任何地方,卸载过程都会找到每个组件(文件、注册表项等),并自动删除它们。相反,在“成功”卸载后,我可以找到每个文件,每个注册表项都未动。我想删除所有内容(文件、注册表项、文件关联) 我做错了什么 <?xml version="1.0" encoding="UTF-8"

我对使用WiX是新手,我创建了一个简单的perUser应用程序安装,其中包含一些文件、一些注册表项和一个文件关联。我用UID把所有东西都放到组件中。安装过程工作得很好

我读了很多关于如何定义什么以及如何卸载这些组件的书,但是在任何地方,卸载过程都会找到每个组件(文件、注册表项等),并自动删除它们。相反,在“成功”卸载后,我可以找到每个文件,每个注册表项都未动。我想删除所有内容(文件、注册表项、文件关联)

我做错了什么

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <!-- DO NOT MODIFY THESE SETTINGS -->
  <?define Manufacturer="MyCompany" ?>
  <?define UpgradeCode="C9998877-7796-4E81-B45B-E7068A15E229" ?>
  <?define VersionNumber="3.3.2"?>
  <?define ProductName="MyCompany Release dosomething" ?>
  <?define ApplicationName="MyCompany Release dosomething App" ?>
  <?define Description="MyCompany Release dosomething Tool" ?>

  <!-- MODIFY THESE SETTINGS AT EVERY NEW VERSION -->
  <?define dosomething_exe_src = "FILES\MyCompanyDoSomething.exe" ?>
  <?define dosomething_ini_src = "FILES\MyCompanyDoSomething.exe.config" ?>
  <?define dosomething_eula_src = "FILES\eula.rtf" ?>


  <Product Id="*"
            Name="$(var.ProductName)"
            Language="1033"
            Version="$(var.VersionNumber)"
            Manufacturer="$(var.Manufacturer)"
            UpgradeCode="$(var.UpgradeCode)">
    <Package Id="*"
             InstallerVersion="200"
             Compressed="yes"
             InstallScope="perUser"
             Manufacturer="$(var.Manufacturer)"
             Description="$(var.Description)"
            InstallPrivileges="limited" />
    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

    <Property Id="ALLUSERS" Secure="yes" />




    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion Minimum="$(var.VersionNumber)" IncludeMinimum="no"
                      OnlyDetect="yes"
                      Property="NEWERVERSIONS" />
      <UpgradeVersion Minimum="0.0.0" IncludeMinimum="yes"
                      Maximum="$(var.VersionNumber)" IncludeMaximum="no"
                      OnlyDetect="no"
                      IgnoreRemoveFailure="yes"
                      Property="OLDERVERSIONS" />
    </Upgrade>

    <Condition Message="A newer version of [ProductName] is already installed. Exiting installation.">
      <![CDATA[Installed OR NOT NEWERVERSIONS]]>
    </Condition>

    <Condition Message="!(loc.LaunchCondition_AllUsers)">
      NOT ALLUSERS
    </Condition>

    <!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
    <!-- :: Installation Variables                                                                      :: -->
    <Property Id="WixAppFolder" Value="WixPerUserFolder" />
    <Property Id="ApplicationFolderName" Value="Install path" />
    <Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER"/>
    <WixVariable Id="WixUILicenseRtf" Value="FILES\eula.rtf" />


    <!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
    <!-- :: Main Installation Directory Structure                                                       :: -->

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="LocalAppDataFolder">
        <!-- perUser case, it is redirected automatically to LocalAppDataFolder -->
        <Directory Id="ProgramFilesHK" Name="$(var.Manufacturer)">
          <Directory Id="APPLICATIONFOLDER" Name="$(var.ApplicationName)">
            <Component Id="CMP_dosomething_exe" Guid="0BA6F4AB-9ED4-4CF2-BDFF-0C95F1DF4BA0" Permanent="no">
              <CreateFolder />
              <RemoveFolder Id="RemoveFolder_ProgramFilesHK" Directory="ProgramFilesHK" On="uninstall" />
              <RemoveFolder Id="RemoveFolder_ApplicationFolder" Directory="APPLICATIONFOLDER" On="uninstall" />

              <File Source="$(var.dosomething_exe_src)" Id="dosomething_exe_file" Vital="yes" />

              <ProgId Id="$(var.ApplicationName).Document" Description="$(var.Description)" Advertise="no">
                <Extension Id="MyCompanyDoSomething" ContentType="application/MyCompanyDoSomething">
                  <Verb Id="Open" Command="Open" Argument="&quot;%1&quot;" TargetFile="dosomething_exe_file"/>
                  <MIME Advertise="no" ContentType="application/MyCompanyDoSomething" Default="yes" />
                </Extension>
              </ProgId>
              <RegistryKey Root="HKCU" Key="Software\MyCompany\MyApplication" ForceDeleteOnUninstall="yes">
                <RegistryValue Name="Version" Value="[ProductVersion]" Type="string" KeyPath="yes"/>
              </RegistryKey>
            </Component>
            <Component Id="CMP_dosomething_ini" Guid="6F0201F1-A1C1-4378-9ED7-5D47AB750AD1">
              <File Source="$(var.dosomething_ini_src)" Id="dosomething_ini_file" Vital="yes"/>
              <RegistryKey Root="HKCU" Key="Software\MyCompany\MyApplication" ForceDeleteOnUninstall="yes">
                <RegistryValue Name="Version" Value="[ProductVersion]" Type="string" KeyPath="yes"/>
              </RegistryKey>
            </Component>
            <Component Id="CMP_eula_doc" Guid="{9D320C1F-E16A-46D3-AF2F-5AE496B8C365}">
              <File Source="$(var.dosomething_eula_src)" Id="dosomething_eula_file" Vital="yes"/>
              <RegistryKey Root="HKCU" Key="Software\MyCompany\MyApplication" ForceDeleteOnUninstall="yes">
                <RegistryValue Name="Version" Value="[ProductVersion]" Type="string" KeyPath="yes"/>
              </RegistryKey>
            </Component>
          </Directory>
        </Directory>
      </Directory>

      <Directory Id="DesktopFolder">
      </Directory>

      <Directory Id="ProgramMenuFolder">
        <Directory Id="AppShortcutsDir" Name="$(var.ApplicationName)" />
      </Directory>
    </Directory>


    <!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
    <!-- :: Desktop -> Shortcut to start the application                                                :: -->
    <DirectoryRef Id="DesktopFolder">
      <Component Id="CMP_DesktopShortcut" Guid="{E6024E33-E5B8-4136-9402-22BA0614013D}">
        <Shortcut Id="DAppStarterShortcut" Name="$(var.ApplicationName)" Description="$(var.Description)" Target="[APPLICATIONFOLDER]MyCompanyDoSomething.exe" />
        <RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
      </Component>
    </DirectoryRef>

    <!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
    <!-- :: Start Menu -> Shortcuts to start the application, eula, uninstall, etc.                     :: -->
    <DirectoryRef Id="AppShortcutsDir">
      <Component Id="CMP_StartMenuShortcut" Guid="{439DAE58-5DE5-4A45-952E-05956D5B4A49}">
        <Shortcut Id="SAppStarterShortcut" Name="$(var.ApplicationName)" Description="$(var.Description)" Target="[APPLICATIONFOLDER]MyCompanyDoSomething.exe" />
        <Shortcut Id="SEulaReadShortcut" Name="$(var.ApplicationName) EULA" Description="End User Agreement" Target="[APPLICATIONFOLDER]eula.rtf" />
        <Shortcut Id="SUninstallShortcut" Name="Uninstall $(var.ApplicationName)" Description="Uninstall $(var.ApplicationName) and all of its components" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]" />
        <RemoveFolder Id="RemoveMyShortcutsDir" On="uninstall" />
        <RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
      </Component>
    </DirectoryRef>




    <!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
    <!-- :: Installation Feature Tree                                                                    :: -->
    <Feature Id="MyCompanyDosomethingTool" Title="MyCompany Dsomething Tool" Level="1" ConfigurableDirectory="APPLICATIONFOLDER">
      <ComponentRef Id="CMP_dosomething_exe" />
      <ComponentRef Id="CMP_dosomething_ini" />
      <ComponentRef Id="CMP_eula_doc" />
      <ComponentRef Id="CMP_StartMenuShortcut" />
      <ComponentRef Id="CMP_DesktopShortcut" />
    </Feature>

    <InstallExecuteSequence>
      <RemoveExistingProducts After="InstallInitialize" />
      <InstallExecute After="RemoveExistingProducts" />
    </InstallExecuteSequence>

    <UIRef Id="WixUI_Mondo" />
  </Product>
</Wix>

不是诱惑者

在组件元素上,您可以添加: RemoveFile、RemoveFolder、RemoveRegistryKey和RemoveRegistryValue元素。看

示例(用于文件夹和密钥):


如果不想覆盖父组件目录,则可以忽略目录属性

据我所知,RemoveFolder组件的Id应该与要删除的目录的Id相匹配(这对我很有用)

在您的情况下,这将转化为如下内容:

<Directory Id="LocalAppDataFolder">
<!-- perUser case, it is redirected automatically to LocalAppDataFolder -->
    <Directory Id="ProgramFilesHK" Name="$(var.Manufacturer)">
      <Directory Id="APPLICATIONFOLDER" Name="$(var.ApplicationName)">
        <Component Id="CMP_dosomething_exe" Guid="0BA6F4AB-9ED4-4CF2-BDFF-0C95F1DF4BA0" Permanent="no">
          <CreateFolder />
          <RemoveFolder Id="ProgramFilesHK" On="uninstall" />
          <RemoveFolder Id="APPLICATIONFOLDER" On="uninstall" />
            [removed stuff]
        </Component>
      </Directory>
    </Directory>
</Directory>

[移除的内容]

请添加一些代码。对不起。编辑了原始问题-添加了源代码。正如您在“CMP_downloader_exe”组件上看到的,我已经添加了RemoveFolder。但是文件夹没有被删除:(我的错。我已经更新了我的回复。希望这有帮助。WIX工具集文档中有一个关于卸载快捷方式的部分,我发现在设置最新的安装程序项目时它很有用。我在卸载日志中看到了几行-但我不明白:MSI(s)(B8:88)[12:27:46:826]:不允许卸载组件:{439DAE58-5DE5-4A45-952E-05956D5B4A49}由于另一个客户端存在,这可能是由于以前的安装引用了组件/GUID。请在regedit中检查GUID,看起来您应该在其中找到CMP_StartMenus快捷方式。我清除了连接到我的应用程序的每个注册表项,现在它可以很好地卸载所有内容。谢谢大家!)
<Directory Id="LocalAppDataFolder">
<!-- perUser case, it is redirected automatically to LocalAppDataFolder -->
    <Directory Id="ProgramFilesHK" Name="$(var.Manufacturer)">
      <Directory Id="APPLICATIONFOLDER" Name="$(var.ApplicationName)">
        <Component Id="CMP_dosomething_exe" Guid="0BA6F4AB-9ED4-4CF2-BDFF-0C95F1DF4BA0" Permanent="no">
          <CreateFolder />
          <RemoveFolder Id="ProgramFilesHK" On="uninstall" />
          <RemoveFolder Id="APPLICATIONFOLDER" On="uninstall" />
            [removed stuff]
        </Component>
      </Directory>
    </Directory>
</Directory>