第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

卸載WiX時(shí)刪除文件

卸載WiX時(shí)刪除文件

卸載WiX時(shí)刪除文件卸載我的應(yīng)用程序時(shí),我想配置Wix設(shè)置以刪除原始安裝后添加的所有文件??雌饋?lái)卸載程序只刪除了最初從MSI文件安裝的目錄和文件,并且它保留了稍后在應(yīng)用程序文件夾中添加的所有其他內(nèi)容。換句話說(shuō),我想在卸載時(shí)清除目錄。我怎么做?
查看完整描述

3 回答

?
哈士奇WWW

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超6個(gè)贊

使用RemoveFile元素和On =“ uninstall ”。這是一個(gè)例子:

<Directory Id="CommonAppDataFolder" Name="CommonAppDataFolder">
  <Directory Id="MyAppFolder" Name="My">
    <Component Id="MyAppFolder" Guid="*">
      <CreateFolder />
      <RemoveFile Id="PurgeAppFolder" Name="*.*" On="uninstall" />
    </Component>
  </Directory></Directory>

更新

它不起作用100%。它刪除了文件,但沒(méi)有刪除任何其他目錄 - 安裝后創(chuàng)建的目錄。有什么想法嗎? - pribeiro

遺憾的是,Windows Installer不支持使用子目錄刪除目錄。在這種情況下,您必須采取自定義操作。或者,如果您知道子文件夾是什么,請(qǐng)創(chuàng)建一堆RemoveFolder和RemoveFile元素。


查看完整回答
反對(duì) 回復(fù) 2019-08-27
?
神不在的星期二

TA貢獻(xiàn)1963條經(jīng)驗(yàn) 獲得超6個(gè)贊

RemoveFolderEx在WiX中使用Util擴(kuò)展中的元素。
使用此方法,還會(huì)刪除所有子目錄(而不是直接使用RemoveFile元素)。此元素在MSI數(shù)據(jù)庫(kù)中添加臨時(shí)行RemoveFileRemoveFolder表。

查看完整回答
反對(duì) 回復(fù) 2019-08-27
?
HUH函數(shù)

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超4個(gè)贊

為此,我只是創(chuàng)建了一個(gè)在卸載時(shí)調(diào)用的自定義操作。

WiX代碼如下所示:

<Binary Id="InstallUtil" src="InstallUtilLib.dll" /><CustomAction Id="DIRCA_TARGETDIR" Return="check" Execute="firstSequence" Property="TARGETDIR" Value="[ProgramFilesFolder][Manufacturer]\[ProductName]" /><CustomAction Id="Uninstall" BinaryKey="InstallUtil" DllEntry="ManagedInstall" Execute="deferred" /><CustomAction Id="UninstallSetProp" Property="Uninstall" Value="/installtype=notransaction /action=uninstall /LogFile= /targetDir=&quot;[TARGETDIR]\Bin&quot; &quot;[#InstallerCustomActionsDLL]&quot; &quot;[#InstallerCustomActionsDLLCONFIG]&quot;" /><Directory Id="BinFolder" Name="Bin" >
    <Component Id="InstallerCustomActions" Guid="*">
        <File Id="InstallerCustomActionsDLL" Name="SetupCA.dll" LongName="InstallerCustomActions.dll" src="InstallerCustomActions.dll" Vital="yes" KeyPath="yes" DiskId="1" Compressed="no" />
        <File Id="InstallerCustomActionsDLLCONFIG" Name="SetupCA.con" LongName="InstallerCustomActions.dll.Config" src="InstallerCustomActions.dll.Config" Vital="yes" DiskId="1" />
    </Component></Directory><Feature Id="Complete" Level="1" ConfigurableDirectory="TARGETDIR">
    <ComponentRef Id="InstallerCustomActions" /></Feature><InstallExecuteSequence>
    <Custom Action="UninstallSetProp" After="MsiUnpublishAssemblies">$InstallerCustomActions=2</Custom>
    <Custom Action="Uninstall" After="UninstallSetProp">$InstallerCustomActions=2</Custom></InstallExecuteSequence>

InstallerCustomActions.DLL中的OnBeforeUninstall方法的代碼如下所示(在VB中)。

Protected Overrides Sub OnBeforeUninstall(ByVal savedState As System.Collections.IDictionary)
    MyBase.OnBeforeUninstall(savedState)

    Try
        Dim CommonAppData As String = Me.Context.Parameters("CommonAppData")
        If CommonAppData.StartsWith("\") And Not CommonAppData.StartsWith("\\") Then
            CommonAppData = "\" + CommonAppData        End If
        Dim targetDir As String = Me.Context.Parameters("targetDir")
        If targetDir.StartsWith("\") And Not targetDir.StartsWith("\\") Then
            targetDir = "\" + targetDir        End If

        DeleteFile("<filename.extension>", targetDir) 'delete from bin directory
        DeleteDirectory("*.*", "<DirectoryName>") 'delete any extra directories created by program
    Catch
    End TryEnd SubPrivate Sub DeleteFile(ByVal searchPattern As String, ByVal deleteDir As String)
    Try
        For Each fileName As String In Directory.GetFiles(deleteDir, searchPattern)
            File.Delete(fileName)
        Next
    Catch
    End TryEnd SubPrivate Sub DeleteDirectory(ByVal searchPattern As String, ByVal deleteDir As String)
    Try
        For Each dirName As String In Directory.GetDirectories(deleteDir, searchPattern)
            Directory.Delete(dirName)
        Next
    Catch
    End TryEnd Sub


查看完整回答
反對(duì) 回復(fù) 2019-08-27
  • 3 回答
  • 0 關(guān)注
  • 1151 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)