How to: Set a custom log file location for ClickOnce deployment errors (如何:設定 ClickOnce 部署錯誤的自訂記錄檔位置)How to: Set a custom log file location for ClickOnce deployment errors

ClickOnceClickOnce 維護所有部署的啟用記錄檔。maintains activation log files for all deployments. 這些記錄會記錄有關安裝和初始化部署的任何錯誤 ClickOnceClickOnceThese logs document any errors pertaining to installing and initializing a ClickOnceClickOnce deployment. 依預設,會 ClickOnceClickOnce 為每個部署啟用建立一個記錄檔。By default, ClickOnceClickOnce creates one log file for each deployment activation. 它會將這些記錄檔儲存在 [Temporary Internet Files] 資料夾中。It stores these log files in the Temporary Internet Files folder. 當啟用失敗時,使用者會看到部署的記錄檔,而使用者會在產生的錯誤對話方塊中按一下 [ 詳細資料 ]。The log file for a deployment is displayed to the user when an activation failure occurs, and the user clicks Details in the resulting error dialog box.

您可以使用登錄編輯程式 ( regedit.exe ) 設定自訂的記錄檔路徑,來變更特定用戶端的這個行為。You can change this behavior for a specific client by using Registry Editor ( regedit.exe ) to set a custom log file path. 在此情況下,會 ClickOnceClickOnce 針對單一檔案中的所有部署記錄啟用成功和失敗。In this case, ClickOnceClickOnce logs activation successes and failures for all deployments in a single file.


如果未正確使用登錄編輯程式,可能會導致嚴重問題,甚至可能必須重新安裝作業系統。If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. 您必須自行負擔使用「登錄編輯程式」的風險。Use Registry Editor at your own risk.


您必須偶爾截斷或刪除記錄檔,以防止其成長過大。You will need to truncate or delete the log file occasionally to prevent it from growing too large.

下列程式描述如何設定單一用戶端的自訂記錄檔位置。The following procedure describes how to set a custom log file location for a single client.

若要設定自訂記錄檔位置To set a custom log file location

  1. 開啟 Regedit.exeOpen Regedit.exe.

  2. 流覽至節點 HKCU\Software\Classes\Software\Microsoft\Windows\CurrentVersion\DeploymentNavigate to the node HKCU\Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment.

  3. 將字串值設定 LogFilePath 為您慣用的自訂記錄檔位置的完整路徑和檔案名。Set the string value LogFilePath to the full path and filename of your preferred custom log location.

    這個位置必須位於使用者具有寫入權限的目錄中。This location must be in a directory to which the user has write access. 例如,在 Windows Vista 上,建立下列資料夾結構並設定 LogFilePathC:\Users \ <username> \Documents\Logs\ClickOnce\installation.logFor example, on Windows Vista, create the following folder structure and set LogFilePath to C:\Users\<username>\Documents\Logs\ClickOnce\installation.log.

請參閱See also