WIX 安装程序,在卸载时,从临时目录中删除文件

Posted

技术标签:

【中文标题】WIX 安装程序,在卸载时,从临时目录中删除文件【英文标题】:WIX Installer, on Uninstall, removing files from Temp Directory 【发布时间】:2019-07-02 20:35:46 【问题描述】:

我正在使用以下简化的安装程序来测试从临时目录中删除文件的情况。我的应用程序将在目录中创建一些文件,我希望在卸载应用程序时将它们删除。

看起来它应该可以工作,日志似乎没有显示太多有用的信息。关于我做错了什么的任何建议?我已经包含了 WixUIExtension 和 WixUtilExtension;在这种情况下,我手动创建了 testTest.txt 文件,它永远不会被删除。我显然错过了一些东西。

更新代码

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

    <Product Name=        "tempApp"
             Manufacturer="tempCompany"
             Id=          "*"
             Language=    "1033"
             Version=     "1.0.0.0"
             UpgradeCode= "BC29783A-3F6B-4A10-A9BF-3C3F63AF7F68">

    <Package Id=                "*"
             Keywords=          "tempApp,Installer"
             Description=       "-- TBD --"
             Comments=          "tempApp (c) 2019, tempCompany"
             Manufacturer=      "tempCompany"
             Languages=         "1033"
             InstallerVersion=  "200"
             Compressed=        "yes"
             InstallScope=      "perMachine"
             Platform=          "x64"/>

    <!-- Force an upgrade of the older versions to the newer version -->
    <Upgrade Id="BC29783A-3F6B-4A10-A9BF-3C3F63AF7F68">
      <UpgradeVersion OnlyDetect=     "no"
                      Property=       "PREVIOUSFOUND"
                      Minimum=        "1.0.0.0"
                      IncludeMinimum= "yes"
                      Maximum=        "99.0.0.0"
                      IncludeMaximum= "no"/>
    </Upgrade>

    <!-- Warn if there is a newer verison of the applicaiton already installed -->
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

    <!-- Disable the Restart Manager Control, doesn't work very well, will have to do it manually afterwards. -->
    <Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" />

    <!-- Defines the name and information on the CAB file that is embedded inside the MSI, doesn't ever need to be changed -->
    <Media Id="1" Cabinet="testApp.cab" EmbedCab="yes"/>

    <!-- Setup the UI to be minimal, and then display the EULA -->
    <UIRef Id="WixUI_Minimal"/>
    <WixVariable Id="WixUILicenseRtf" Value="EULA.rtf"/>

    <!-- Sets up the location where the Custom Actions will be executed -->
    <Property Id="WixShellExecTarget" Value="[#applicationFolder]"/>

    <!-- Define the directory where the files are supposed to go -->
    <Directory Id="TARGETDIR" Name="SourceDir">

      <!-- Create the tempApp Folder in the Program Files Directory -->
      <Directory Id="ProgramFiles64Folder" Name="ProgramFilesx64">

        <!-- Define the Directory where the files of the application are to be placed -->
        <Directory Id="applicationFolder" Name="testApp">
          <!-- Test Application File -->
          <Component Id="testApp_Component" Win64="yes">
            <File Id=       "testApp"
                  Name=     "testApp.exe"
                  Source=   "testApp.exe"
                  KeyPath=  "yes"/>
            <RemoveFile Id=   "AppTesting"
                        On=   "uninstall"
                        Name= "Testing.txt"/>
          </Component>
          <Component Id="testBatch_Component" Win64="yes">
            <File Id=       "testBatchApp"
                  Name=     "testBatch.bat"
                  Source=   "testBatch.bat"
                  KeyPath=  "yes"/>
          </Component>
        </Directory>
      </Directory>

      <!-- Define the Temporary Directory -->
      <Directory Id="tempData" Name="TempFolder">
        <Component Id="tempBatchFile" Guid="FD8CFE50-436A-4BAA-B9DD-F2E091481AB3" Win64="yes">
          <File Id=     "testBatch"
                Name=   "testBatch.bat"
                Source= "testBatch.bat"
                KeyPath="yes"/>
          <RemoveFile Id=   "testTest"
                      On=   "uninstall"
                      Name= "Testing.txt"/>
        </Component>
      </Directory>

    </Directory>

    <!-- Define what is considered a complete install -->
    <Feature Id=    "CompleteInstall"
              Title= "tempTest"
              Level= "1">
      <ComponentRef Id="testApp_Component"/>
      <ComponentRef Id="testBatch_Component"/>
      <ComponentRef Id="tempBatchFile"/>
    </Feature>

  </Product>
</Wix>

我一直在阅读的其他链接,它们似乎都适用于与应用程序安装在同一目录中的文件。 我一直在尝试关注的其他链接

Orphaned on Removal WiX installer not removing files on uninstall Wix RemoveFile and RemoveFolder for removing leftovers How can I delete generated folders and files via Wix on uninstall? Removing files when uninstalling WiX

安装日志文件

=== Logging started: 7/3/2019  9:22:14 ===
Action 9:22:14: INSTALL. 
Action start 9:22:14: INSTALL.
Action 9:22:14: FindRelatedProducts. Searching for related applications
Action start 9:22:14: FindRelatedProducts.
Action ended 9:22:14: FindRelatedProducts. Return value 1.
Action 9:22:14: PrepareDlg. 
Action start 9:22:14: PrepareDlg.
Info 2898.For WixUI_Font_Normal textstyle, the system created a 'Tahoma' font, in 0 character set, of 13 pixels height.
Info 2898.For WixUI_Font_Bigger textstyle, the system created a 'Tahoma' font, in 0 character set, of 19 pixels height.
Action 9:22:14: PrepareDlg. Dialog created
Action ended 9:22:14: PrepareDlg. Return value 1.
Action 9:22:14: AppSearch. Searching for installed applications
Action start 9:22:14: AppSearch.
Action ended 9:22:14: AppSearch. Return value 0.
Action 9:22:14: LaunchConditions. Evaluating launch conditions
Action start 9:22:14: LaunchConditions.
Action ended 9:22:14: LaunchConditions. Return value 1.
Action 9:22:14: ValidateProductID. 
Action start 9:22:14: ValidateProductID.
Action ended 9:22:14: ValidateProductID. Return value 1.
Action 9:22:14: CostInitialize. Computing space requirements
Action start 9:22:14: CostInitialize.
Action ended 9:22:14: CostInitialize. Return value 1.
Action 9:22:14: FileCost. Computing space requirements
Action start 9:22:14: FileCost.
Action ended 9:22:14: FileCost. Return value 1.
Action 9:22:14: CostFinalize. Computing space requirements
Action start 9:22:14: CostFinalize.
Action ended 9:22:14: CostFinalize. Return value 1.
Action 9:22:14: MigrateFeatureStates. Migrating feature states from related applications
Action start 9:22:14: MigrateFeatureStates.
Action ended 9:22:14: MigrateFeatureStates. Return value 0.
Action 9:22:14: WelcomeEulaDlg. 
Action start 9:22:14: WelcomeEulaDlg.
Info 2898.For WixUI_Font_Title textstyle, the system created a 'Tahoma' font, in 0 character set, of 14 pixels height.
Action 9:22:14: WelcomeEulaDlg. Dialog created
Action ended 9:22:17: WelcomeEulaDlg. Return value 1.
Action 9:22:17: ProgressDlg. 
Action start 9:22:17: ProgressDlg.
Action 9:22:17: ProgressDlg. Dialog created
Action ended 9:22:17: ProgressDlg. Return value 1.
Action 9:22:17: ExecuteAction. 
Action start 9:22:17: ExecuteAction.
Action 9:22:18: INSTALL. 
Action start 9:22:18: INSTALL.
Action 9:22:18: FindRelatedProducts. Searching for related applications
Action start 9:22:18: FindRelatedProducts.
Action ended 9:22:18: FindRelatedProducts. Return value 0.
Action 9:22:18: LaunchConditions. Evaluating launch conditions
Action start 9:22:18: LaunchConditions.
Action ended 9:22:18: LaunchConditions. Return value 1.
Action 9:22:18: ValidateProductID. 
Action start 9:22:18: ValidateProductID.
Action ended 9:22:18: ValidateProductID. Return value 1.
Action 9:22:18: CostInitialize. Computing space requirements
Action start 9:22:18: CostInitialize.
Action ended 9:22:18: CostInitialize. Return value 1.
Action 9:22:18: FileCost. Computing space requirements
Action start 9:22:18: FileCost.
Action ended 9:22:18: FileCost. Return value 1.
Action 9:22:18: CostFinalize. Computing space requirements
Action start 9:22:18: CostFinalize.
Action ended 9:22:18: CostFinalize. Return value 1.
Action 9:22:18: MigrateFeatureStates. Migrating feature states from related applications
Action start 9:22:18: MigrateFeatureStates.
Action ended 9:22:18: MigrateFeatureStates. Return value 0.
Action 9:22:18: InstallValidate. Validating install
Action start 9:22:18: InstallValidate.
Action ended 9:22:18: InstallValidate. Return value 1.
Action 9:22:18: RemoveExistingProducts. Removing applications
Action start 9:22:18: RemoveExistingProducts.
Action ended 9:22:18: RemoveExistingProducts. Return value 1.
Action 9:22:18: InstallInitialize. 
Action start 9:22:18: InstallInitialize.
Action ended 9:22:18: InstallInitialize. Return value 1.
Action 9:22:18: ProcessComponents. Updating component registration
Action start 9:22:18: ProcessComponents.
Action 9:22:18: GenerateScript. Generating script operations for action:
GenerateScript: Updating component registration
Action ended 9:22:18: ProcessComponents. Return value 1.
Action 9:22:18: UnpublishFeatures. Unpublishing Product Features
Action start 9:22:18: UnpublishFeatures.
Action ended 9:22:18: UnpublishFeatures. Return value 1.
Action 9:22:18: RemoveFiles. Removing files
Action start 9:22:18: RemoveFiles.
Action ended 9:22:18: RemoveFiles. Return value 1.
Action 9:22:18: InstallFiles. Copying new files
Action start 9:22:18: InstallFiles.
InstallFiles: File: Copying new files,  Directory: ,  Size: 
Action ended 9:22:18: InstallFiles. Return value 1.
Action 9:22:18: RegisterUser. Registering user
Action start 9:22:18: RegisterUser.
Action ended 9:22:18: RegisterUser. Return value 1.
Action 9:22:18: RegisterProduct. Registering product
Action start 9:22:18: RegisterProduct.
RegisterProduct: Registering product
Action ended 9:22:18: RegisterProduct. Return value 1.
Action 9:22:18: PublishFeatures. Publishing Product Features
Action start 9:22:18: PublishFeatures.
PublishFeatures: Feature: Publishing Product Features
Action ended 9:22:18: PublishFeatures. Return value 1.
Action 9:22:18: PublishProduct. Publishing product information
Action start 9:22:18: PublishProduct.
PublishProduct: 
Action ended 9:22:18: PublishProduct. Return value 1.
Action 9:22:18: InstallFinalize. 
Action start 9:22:18: InstallFinalize.
Action 9:22:18: ProcessComponents. Updating component registration
1: 8AC268E8-DB18-4769-A515-73B9BF048CCF 2: 33F795F0-CF34-5459-8836-0FFC648586A1 3: C:\Program Files\testApp\testApp.exe 
1: 8AC268E8-DB18-4769-A515-73B9BF048CCF 2: C91144C7-3133-5BDB-8ACD-192C7CC1DA58 3: C:\Program Files\testApp\testBatch.bat 
1: 8AC268E8-DB18-4769-A515-73B9BF048CCF 2: FD8CFE50-436A-4BAA-B9DD-F2E091481AB3 3: C:\TempFolder\testBatch.bat 
Action 9:22:18: InstallFiles. Copying new files
InstallFiles: File: testApp.exe,  Directory: C:\Program Files\testApp\,  Size: 9
InstallFiles: File: testBatch.bat,  Directory: C:\TempFolder\,  Size: 52
InstallFiles: File: testBatch.bat,  Directory: C:\Program Files\testApp\,  Size: 52
Action 9:22:18: RegisterProduct. Registering product
RegisterProduct: 8AC268E8-DB18-4769-A515-73B9BF048CCF
Action 9:22:18: PublishFeatures. Publishing Product Features
PublishFeatures: Feature: CompleteInstall
Action 9:22:18: PublishProduct. Publishing product information
1: 8AC268E8-DB18-4769-A515-73B9BF048CCF 
Action 9:22:18: RollbackCleanup. Removing backup files
Action ended 9:22:18: InstallFinalize. Return value 1.
Action ended 9:22:18: INSTALL. Return value 1.
Property(S): UpgradeCode = BC29783A-3F6B-4A10-A9BF-3C3F63AF7F68
Property(S): applicationFolder = C:\Program Files\testApp\
Property(S): tempData = C:\TempFolder\
Property(S): WixUIRMOption = UseRM
Property(S): ALLUSERS = 1
Property(S): ARPNOMODIFY = 1
Property(S): ProgramFiles64Folder = C:\Program Files\
Property(S): TARGETDIR = C:\
Property(S): SourceDir = Z:\SOFTWARE-DISTRIBUTION\Testing\
Property(S): MSIRESTARTMANAGERCONTROL = Disable
Property(S): WixShellExecTarget = [#applicationFolder]
Property(S): Manufacturer = tempCompany
Property(S): ProductCode = 8AC268E8-DB18-4769-A515-73B9BF048CCF
Property(S): ProductLanguage = 1033
Property(S): ProductName = tempApp
Property(S): ProductVersion = 1.0.0.0
Property(S): DefaultUIFont = WixUI_Font_Normal
Property(S): WixUI_Mode = Minimal
Property(S): ErrorDialog = ErrorDlg
Property(S): SecureCustomProperties = PREVIOUSFOUND;WIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED
Property(S): MsiLogFileLocation = Z:\SOFTWARE-DISTRIBUTION\Testing\installer.log
Property(S): PackageCode = 4A3B3BD3-D454-4BA4-B42A-1170B3BC5F46
Property(S): ProductState = -1
Property(S): PackagecodeChanging = 1
Property(S): CURRENTDIRECTORY = Z:\SOFTWARE-DISTRIBUTION\Testing
Property(S): CLIENTUILEVEL = 0
Property(S): CLIENTPROCESSID = 9088
Property(S): USERNAME = Windows User
Property(S): COMPANYNAME = Test Company Inc.
Property(S): VersionDatabase = 200
Property(S): ACTION = INSTALL
Property(S): EXECUTEACTION = INSTALL
Property(S): ROOTDRIVE = C:\
Property(S): INSTALLLEVEL = 1
Property(S): SECONDSEQUENCE = 1
Property(S): ADDLOCAL = CompleteInstall
Property(S): MsiSystemRebootPending = 1
Property(S): VersionMsi = 5.00
Property(S): VersionNT = 603
Property(S): VersionNT64 = 603
Property(S): WindowsBuild = 9600
Property(S): ServicePackLevel = 0
Property(S): ServicePackLevelMinor = 0
Property(S): MsiNTProductType = 1
Property(S): WindowsFolder = C:\WINDOWS\
Property(S): WindowsVolume = C:\
Property(S): System64Folder = C:\WINDOWS\system32\
Property(S): SystemFolder = C:\WINDOWS\SysWOW64\
Property(S): RemoteAdminTS = 1
Property(S): TempFolder = C:\Users\<user>\AppData\Local\Temp\
Property(S): ProgramFilesFolder = C:\Program Files (x86)\
Property(S): CommonFilesFolder = C:\Program Files (x86)\Common Files\
Property(S): CommonFiles64Folder = C:\Program Files\Common Files\
Property(S): AppDataFolder = C:\Users\<user>\AppData\Roaming\
Property(S): FavoritesFolder = C:\Users\<user>\Favorites\
Property(S): NetHoodFolder = C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Network Shortcuts\
Property(S): PersonalFolder = C:\Users\<user>\Documents\
Property(S): PrintHoodFolder = C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Printer Shortcuts\
Property(S): RecentFolder = C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Recent\
Property(S): SendToFolder = C:\Users\<user>\AppData\Roaming\Microsoft\Windows\SendTo\
Property(S): TemplateFolder = C:\ProgramData\Microsoft\Windows\Templates\
Property(S): CommonAppDataFolder = C:\ProgramData\
Property(S): LocalAppDataFolder = C:\Users\<user>\AppData\Local\
Property(S): MyPicturesFolder = C:\Users\<user>\Pictures\
Property(S): AdminToolsFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\
Property(S): StartupFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\
Property(S): ProgramMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\
Property(S): StartMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\
Property(S): DesktopFolder = C:\Users\Public\Desktop\
Property(S): FontsFolder = C:\WINDOWS\Fonts\
Property(S): GPTSupport = 1
Property(S): OLEAdvtSupport = 1
Property(S): ShellAdvtSupport = 1
Property(S): MsiAMD64 = 6
Property(S): Msix64 = 6
Property(S): Intel = 6
Property(S): PhysicalMemory = 16383
Property(S): VirtualMemory = 14552
Property(S): LogonUser = <user>
Property(S): UserSID = S-1-5-21-1039747452-301181775-3212777973-4608
Property(S): UserLanguageID = 1033
Property(S): ComputerName = SCI-555VM
Property(S): SystemLanguageID = 1033
Property(S): ScreenX = 1024
Property(S): ScreenY = 768
Property(S): CaptionHeight = 23
Property(S): BorderTop = 1
Property(S): BorderSide = 1
Property(S): TextHeight = 16
Property(S): TextInternalLeading = 3
Property(S): ColorBits = 32
Property(S): TTCSupport = 1
Property(S): Time = 9:22:18
Property(S): Date = 7/3/2019
Property(S): MsiNetAssemblySupport = 4.7.3056.0
Property(S): MsiWin32AssemblySupport = 6.3.17134.1
Property(S): RedirectedDllSupport = 2
Property(S): AdminUser = 1
Property(S): MsiRunningElevated = 1
Property(S): Privileged = 1
Property(S): DATABASE = C:\WINDOWS\Installer\53a5126.msi
Property(S): OriginalDatabase = Z:\SOFTWARE-DISTRIBUTION\Testing\testInstaller.msi
Property(S): UILevel = 5
Property(S): Preselected = 1
Property(S): CostingComplete = 1
Property(S): OutOfDiskSpace = 0
Property(S): OutOfNoRbDiskSpace = 0
Property(S): PrimaryVolumeSpaceAvailable = 0
Property(S): PrimaryVolumeSpaceRequired = 0
Property(S): PrimaryVolumeSpaceRemaining = 0
Property(S): SOURCEDIR = Z:\SOFTWARE-DISTRIBUTION\Testing\
Property(S): SourcedirProduct = 8AC268E8-DB18-4769-A515-73B9BF048CCF
Property(S): ProductToBeRegistered = 1
Action ended 9:22:18: ExecuteAction. Return value 1.
Action 9:22:18: ExitDialog. 
Action start 9:22:18: ExitDialog.
Action 9:22:18: ExitDialog. Dialog created
Action ended 9:22:19: ExitDialog. Return value 1.
Action ended 9:22:19: INSTALL. Return value 1.
Property(C): UpgradeCode = BC29783A-3F6B-4A10-A9BF-3C3F63AF7F68
Property(C): LicenseAccepted = 1
Property(C): applicationFolder = C:\Program Files\testApp\
Property(C): tempData = C:\TempFolder\
Property(C): WixUIRMOption = UseRM
Property(C): ALLUSERS = 1
Property(C): ARPNOMODIFY = 1
Property(C): ProgramFiles64Folder = C:\Program Files\
Property(C): TARGETDIR = C:\
Property(C): SourceDir = Z:\SOFTWARE-DISTRIBUTION\Testing\
Property(C): MSIRESTARTMANAGERCONTROL = Disable
Property(C): WixShellExecTarget = [#applicationFolder]
Property(C): Manufacturer = tempCompany
Property(C): ProductCode = 8AC268E8-DB18-4769-A515-73B9BF048CCF
Property(C): ProductLanguage = 1033
Property(C): ProductName = tempApp
Property(C): ProductVersion = 1.0.0.0
Property(C): DefaultUIFont = WixUI_Font_Normal
Property(C): WixUI_Mode = Minimal
Property(C): ErrorDialog = ErrorDlg
Property(C): SecureCustomProperties = PREVIOUSFOUND;WIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED
Property(C): MsiLogFileLocation = Z:\SOFTWARE-DISTRIBUTION\Testing\installer.log
Property(C): PackageCode = 4A3B3BD3-D454-4BA4-B42A-1170B3BC5F46
Property(C): ProductState = -1
Property(C): PackagecodeChanging = 1
Property(C): CURRENTDIRECTORY = Z:\SOFTWARE-DISTRIBUTION\Testing
Property(C): CLIENTUILEVEL = 0
Property(C): CLIENTPROCESSID = 9088
Property(C): VersionDatabase = 200
Property(C): MsiSystemRebootPending = 1
Property(C): VersionMsi = 5.00
Property(C): VersionNT = 603
Property(C): VersionNT64 = 603
Property(C): WindowsBuild = 9600
Property(C): ServicePackLevel = 0
Property(C): ServicePackLevelMinor = 0
Property(C): MsiNTProductType = 1
Property(C): WindowsFolder = C:\WINDOWS\
Property(C): WindowsVolume = C:\
Property(C): System64Folder = C:\WINDOWS\system32\
Property(C): SystemFolder = C:\WINDOWS\SysWOW64\
Property(C): RemoteAdminTS = 1
Property(C): TempFolder = C:\Users\<user>\AppData\Local\Temp\
Property(C): ProgramFilesFolder = C:\Program Files (x86)\
Property(C): CommonFilesFolder = C:\Program Files (x86)\Common Files\
Property(C): CommonFiles64Folder = C:\Program Files\Common Files\
Property(C): AppDataFolder = C:\Users\<user>\AppData\Roaming\
Property(C): FavoritesFolder = C:\Users\<user>\Favorites\
Property(C): NetHoodFolder = C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Network Shortcuts\
Property(C): PersonalFolder = C:\Users\<user>\Documents\
Property(C): PrintHoodFolder = C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Printer Shortcuts\
Property(C): RecentFolder = C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Recent\
Property(C): SendToFolder = C:\Users\<user>\AppData\Roaming\Microsoft\Windows\SendTo\
Property(C): TemplateFolder = C:\ProgramData\Microsoft\Windows\Templates\
Property(C): CommonAppDataFolder = C:\ProgramData\
Property(C): LocalAppDataFolder = C:\Users\<user>\AppData\Local\
Property(C): MyPicturesFolder = C:\Users\<user>\Pictures\
Property(C): AdminToolsFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\
Property(C): StartupFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\
Property(C): ProgramMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\
Property(C): StartMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\
Property(C): DesktopFolder = C:\Users\Public\Desktop\
Property(C): FontsFolder = C:\WINDOWS\Fonts\
Property(C): GPTSupport = 1
Property(C): OLEAdvtSupport = 1
Property(C): ShellAdvtSupport = 1
Property(C): MsiAMD64 = 6
Property(C): Msix64 = 6
Property(C): Intel = 6
Property(C): PhysicalMemory = 16383
Property(C): VirtualMemory = 14556
Property(C): LogonUser = <user>
Property(C): UserSID = <something>
Property(C): UserLanguageID = 1033
Property(C): ComputerName = SCI-555VM
Property(C): SystemLanguageID = 1033
Property(C): ScreenX = 1920
Property(C): ScreenY = 1200
Property(C): CaptionHeight = 23
Property(C): BorderTop = 1
Property(C): BorderSide = 1
Property(C): TextHeight = 16
Property(C): TextInternalLeading = 3
Property(C): ColorBits = 32
Property(C): TTCSupport = 1
Property(C): Time = 9:22:19
Property(C): Date = 7/3/2019
Property(C): MsiNetAssemblySupport = 4.7.3056.0
Property(C): MsiWin32AssemblySupport = 6.3.17134.1
Property(C): RedirectedDllSupport = 2
Property(C): AdminUser = 1
Property(C): Privileged = 1
Property(C): USERNAME = Windows User
Property(C): COMPANYNAME = Test Company Inc.
Property(C): DATABASE = C:\Users\<user>\AppData\Local\Temp\53a9b49.msi
Property(C): OriginalDatabase = Z:\SOFTWARE-DISTRIBUTION\Testing\testInstaller.msi
Property(C): SOURCEDIR = Z:\SOFTWARE-DISTRIBUTION\Testing\
Property(C): VersionHandler = 5.00
Property(C): UILevel = 5
Property(C): ACTION = INSTALL
Property(C): EXECUTEACTION = INSTALL
Property(C): ROOTDRIVE = C:\
Property(C): CostingComplete = 1
Property(C): OutOfDiskSpace = 0
Property(C): OutOfNoRbDiskSpace = 0
Property(C): PrimaryVolumeSpaceAvailable = 0
Property(C): PrimaryVolumeSpaceRequired = 0
Property(C): PrimaryVolumeSpaceRemaining = 0
Property(C): INSTALLLEVEL = 1
=== Logging stopped: 7/3/2019  9:22:19 ===
MSI (c) (80:28) [09:22:19:715]: Product: tempApp -- Installation completed successfully.

MSI (c) (80:28) [09:22:19:715]: Windows Installer installed the product. Product Name: tempApp. Product Version: 1.0.0.0. Product Language: 1033. Manufacturer: tempCompany. Installation success or error status: 0.

最新发现

通过查看安装日志,似乎 TempFolder 直到安装后期才被分配正确的值,因此文件被复制到 c:\TempFolder 而不是出现的 c:\Users\\AppData\Temp在日志文件中进一步有效。我已经尝试将“值”设置为“TempFolder”、“[TempFolder]”和“[#TempFolder]”,但都只是导致 c:[TempFolder Name]。

【问题讨论】:

你的应用程序不应该自己做这个清理吗? 理想情况下会这样,但其中一些信息是跨会话共享的,需要创建/保留。我可以很容易地编写一个自定义操作来在卸载期间删除这些文件,但我不应该这样做,WiX 完全有能力为我做这件事。只是想弄清楚为什么它不删除文件。请注意,我最关心的文件位于其他但与 Temp 类似的目录中。我在这里链接的代码只是为了显示我遇到的问题,我很有信心如果我解决了这个问题,它将解决其他问题。 我一直在尝试关注此链接:Removing files when Uninstalling 但它似乎只适用于与安装应用程序相同的目录中的文件。这就是我询问 Temp 目录的原因文件删除,它应该是类似的,但它不工作。 刚刚更新,我最终编写了一个独立的自定义操作来删除我想在卸载应用程序时删除的文件。我永远无法弄清楚如何让 wix 做到这一点。 :( 【参考方案1】:

没有真正的答案,但我的解决方案是编写一个自定义操作来执行我试图让 WiX 工具执行的清理工作。不是一个理想的解决方案,但它工作。如果有人有更好的方法来做到这一点,我不需要编写自己的清理代码,那将不胜感激。

【讨论】:

以上是关于WIX 安装程序,在卸载时,从临时目录中删除文件的主要内容,如果未能解决你的问题,请参考以下文章

WiX 安装程序在卸载时删除文件,但在升级时不删除

Wix 自定义卸载操作 - 如何在 msi 删除文件之前运行

卸载时未删除Windows服务(WIX 3)

如何在卸载时立即生成WIX执行命令

我搞砸了,我该如何卸载我的程序?

无法删除其他安装程序安装的文件