卸载应用程序后必须删除已安装的应用程序文件夹吗?

时间:2013-04-29 09:34:19

标签: wix wix3

我是Wix的新手。使用Wix3.0。

我创建了一个安装在“C:\ Program Files \ MyWix \”路径中的msi,并为MyWix文件夹授予了GenericWrite =“yes”的权限。

我的问题是在卸载msi之后。 MyWix文件夹和包含的文件不会被删除。即使我无法手动删除MyWix文件夹。它表示您无权删除此文件夹。

我的代码如下。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="b3fd2c4b-7ea3-415f-975a-2f8245c5d862" Name="MyWix" Language="1033" Version="1.0.0.0" Manufacturer="MyWix" UpgradeCode="f0094887-e58c-48f7-bbf1-0e60ad7c66f9">
        <Package InstallerVersion="200" Compressed="yes" />

        <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLLOCATION" Name="MyWix">

          <Component Id="test" Guid="">
            <File Id="test1" Name="test.docx" Source="D:\RenewDCP.docx" KeyPath="yes"></File>
          </Component>
                </Directory>
            </Directory>
        </Directory>
    <Component Id="MyWix" Directory="INSTALLLOCATION" Guid="{20D7541C-15A7-4c29-8FDE-14DAF191A959}">
      <CreateFolder>
        <Permission GenericWrite="yes" User="Everyone"/>
      </CreateFolder>
    </Component>

    <CustomAction Id="InstallSetProp" Property="Install" Value="/installtype=transaction /action=install " />
    <CustomAction Id="UnInstallSetProp" Property="Uninstall" Value="/installtype=transaction /action=uninstall" />

        <Feature Id="ProductFeature" Title="MyWix" Level="1" ConfigurableDirectory="INSTALLLOCATION">
            <!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
            <!-- <ComponentRef Id="ProductComponent" /> -->
      <ComponentRef Id="MyWix"/>
      <ComponentRef Id="test"/>
        </Feature>
    <UIRef Id="WixUI_Common"/>
    <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
    <Property Id="ARPNOMODIFY" Value="1" />
    <Property Id="WixAppFolder" Value="WixPerUserFolder" />
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
    <WixVariable Id="WixUISupportPerMachine" Value="1" />
    <WixVariable Id="WixUISupportPerUser" Value="1" />
    <WixVariable Id="WixUIBannerBmp" Value="Images\Banner.bmp" />
    <WixVariable Id="WixUIDialogBmp" Value="Images\Dialog.bmp" />
    <InstallExecuteSequence>
      <LaunchConditions After="AppSearch" />
      <Custom Action="InstallSetProp" After="InstallFiles">$MyWix&gt;2</Custom>
      <Custom Action="UnInstallSetProp" After="MsiUnpublishAssemblies">$MyWix=2</Custom>
      <RemoveExistingProducts After="InstallFinalize" />
      <ScheduleReboot After="InstallFinalize" />
    </InstallExecuteSequence>
    <UI Id="WixUI_Advanced">
      <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" />
      <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="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
      <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallScopeDlg">1</Publish>
      <Publish Dialog="InstallScopeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
      <Publish Dialog="InstallScopeDlg" Control="Next" Property="ALLUSERS" Order="1" Value="{}">WixAppFolder = "WixPerUserFolder"</Publish>
      <Publish Dialog="InstallScopeDlg" Control="Next" Property="ALLUSERS" Order="2" Value="1">WixAppFolder = "WixPerMachineFolder"</Publish>
      <Publish Dialog="InstallScopeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlg">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="2">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="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" 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>
    </UI>

    </Product>
</Wix>

plz建议我。

2 个答案:

答案 0 :(得分:3)

您可能希望确保SYSTEMAdministrators仍可以操作该文件夹。使用上面的代码,剩下的唯一权限是write。你可以尝试:

<Component Id="MyWix" Directory="INSTALLLOCATION" Guid="{20D7541C-15A7-4c29-8FDE-14DAF191A959}">
  <CreateFolder>
    <Permission GenericWrite="yes" User="Everyone"/>
    <Permission GenericAll="yes" User="SYSTEM"/>
    <Permission GenericAll="yes" User="Administrators"/>
  </CreateFolder>
</Component>

答案 1 :(得分:1)

使用 GenericAll 代替 GenericWrite ,它拥有安装文件夹的完全权限。

<Permission GenericAll="yes" User="Everyone"/>