dotnet nuget localsdotnet nuget locals

本主題適用於:✓ .NET Core 1.x SDK .NET Core 2.x SDKThis topic applies to: ✓ .NET Core 1.x SDK .NET Core 2.x SDK

名稱Name

dotnet nuget locals - 清除或列出本機 NuGet 資源。dotnet nuget locals - Clears or lists local NuGet resources.

概要Synopsis

dotnet nuget locals <CACHE_LOCATION> [(-c|--clear)|(-l|--list)] [--force-english-output]
dotnet nuget locals [-h|--help]

說明Description

dotnet nuget locals 命令會清除或列出 http-request 快取、暫時快取,或整部電腦全域套件資料夾中的本機 NuGet 資源。The dotnet nuget locals command clears or lists local NuGet resources in the http-request cache, temporary cache, or machine-wide global packages folder.

引數Arguments

  • CACHE_LOCATION

    要列出或清除的快取位置。The cache location to list or clear. 它接受下列其中一個值:It accepts one of the following values:

    • all - 指出指定的作業會套用至所有快取類型:http-request 快取、全域套件快取和暫時快取。all - Indicates that the specified operation is applied to all cache types: http-request cache, global packages cache, and the temporary cache.
    • http-cache - 指出指定的作業只套用至 http-request 快取。http-cache - Indicates that the specified operation is applied only to the http-request cache. 其他快取位置不受影響。The other cache locations aren't affected.
    • global-packages - 指出指定的作業只套用至全域套件快取。global-packages - Indicates that the specified operation is applied only to the global packages cache. 其他快取位置不受影響。The other cache locations aren't affected.
    • temp - 指出指定的作業只套用至暫時快取。temp - Indicates that the specified operation is applied only to the temporary cache. 其他快取位置不受影響。The other cache locations aren't affected.

選項Options

  • --force-english-output

    強制使用非變異英文文化特性來執行應用程式。Forces the application to run using an invariant, English-based culture.

  • -h|--help

    印出命令的簡短說明。Prints out a short help for the command.

  • -c|--clear

    清除選項會針對指定的快取類型執行清除作業。The clear option executes a clear operation on the specified cache type. 系統會以遞迴方式刪除快取目錄的內容。The contents of the cache directories are deleted recursively. 執行的使用者/群組必須具有快取目錄中檔案的權限。The executing user/group must have permission to the files in the cache directories. 如果沒有權限,則會顯示錯誤,指出尚未清除的檔案/資料夾。If not, an error is displayed indicating the files/folders that weren't cleared.

  • -l|--list

    list 選項是用來顯示指定之快取類型的位置。The list option is used to display the location of the specified cache type.

範例Examples

  • 顯示所有本機快取目錄的路徑 (http-cache 目錄、global-packages 快取目錄及暫時快取目錄):Displays the paths of all the local cache directories (http-cache directory, global-packages cache directory, and temporary cache directory):

    dotnet nuget locals –l all
    
  • 顯示本機 http-cache 目錄的路徑:Displays the path for the local http-cache directory:

    dotnet nuget locals --list http-cache
    
  • 清除所有本機快取目錄的所有檔案 (http-cache 目錄、global-packages 快取目錄及暫時快取目錄):Clears all files from all local cache directories (http-cache directory, global-packages cache directory, and temporary cache directory):

    dotnet nuget locals --clear all
    
  • 清除本機 global-packages 快取目錄中的所有檔案:Clears all files in local global-packages cache directory:

    dotnet nuget locals -c global-packages
    
  • 清除本機暫時快取目錄中的所有檔案:Clears all files in local temporary cache directory:

    dotnet nuget locals -c temp
    

疑難排解Troubleshooting

如需使用 dotnet nuget locals 命令時常見的問題與錯誤資訊,請參閱管理 NuGet 快取For information on common problems and errors while using the dotnet nuget locals command, see Managing the NuGet cache.