1

我是 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>

请建议我。

4

2 回答 2

3

您可能希望确保SYSTEM并且Administrators仍然可以操作该文件夹。使用上面的代码,剩下的唯一权限是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>
于 2013-04-29T12:57:40.747 回答
1

使用GenericAll而不是GenericWrite,它对安装文件夹具有完全权限。

<Permission GenericAll="yes" User="Everyone"/>
于 2013-04-29T11:18:07.350 回答