cgsabari
cgsabari

Reputation: 615

Have to delete installed application folder after uninstallation of application?

I'm new to Wix. using Wix3.0.

I've created one msi which is installed in "C:\Program Files\MyWix\" path and given permission as GenericWrite="yes" for the MyWix folder.

My problem is after uninstalled msi. MyWix folder and contained files are not deleted. Even i can't delete MyWix folder manually. It saying you don't have permission to delete this folder like that.

My code is given below.,

<?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 suggest me.

Upvotes: 1

Views: 1125

Answers (2)

Rob Mensching
Rob Mensching

Reputation: 35901

You'll probably want to ensure that SYSTEM and Administrators can still manipulate the folder. With your code above, the only permission remaining is write. You can try:

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

Upvotes: 3

Vinoth
Vinoth

Reputation: 1995

Use GenericAll instead of GenericWrite, it has full rights on installation folder.

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

Upvotes: 1

Related Questions