dotnet storedotnet store

本主題適用於:✓ .NET Core 2.0 SDK 和更新版本This topic applies to: ✓ .NET Core 2.0 SDK and later versions


dotnet store - 會在執行階段套件存放區中儲存指定的組件。dotnet store - Stores the specified assemblies in the runtime package store.


dotnet store -m|--manifest -f|--framework -r|--runtime [--framework-version] [-h|--help] [--output] [--skip-optimization] [--skip-symbols] [-v|--verbosity] [--working-dir]


dotnet store 會在執行階段套件存放區中儲存指定的組件。dotnet store stores the specified assemblies in the runtime package store. 根據預設,會針對目標執行階段和架構最佳化組件。By default, assemblies are optimized for the target runtime and framework. 如需詳細資訊,請參閱執行階段套件存放區主題。For more information, see the runtime package store topic.

必要選項Required options

-f|--framework <FRAMEWORK>

指定目標 FrameworkSpecifies the target framework.

-m|--manifest <PATH_TO_MANIFEST_FILE>

「套件存放區資訊清單檔」是 XML 檔,包含要儲存的套件清單。The package store manifest file is an XML file that contains the list of packages to store. 資訊清單檔的格式相容於 SDK 樣式專案格式。The format of the manifest file is compatible with the SDK-style project format. 因此,參考所需套件的專案檔可以搭配 -m|--manifest 選項,將組件儲存在執行階段套件存放區中。So, a project file that references the desired packages can be used with the -m|--manifest option to store assemblies in the runtime package store. 若要指定多個資訊清單檔,請為每個檔案重複選項和路徑。To specify multiple manifest files, repeat the option and path for each file. 例如:--manifest packages1.csproj --manifest packages2.csprojFor example: --manifest packages1.csproj --manifest packages2.csproj.


目標的執行階段識別碼The runtime identifier to target.

選擇性的選項Optional options

--framework-version <FRAMEWORK_VERSION>

指定 .NET Core SDK 版本。Specifies the .NET Core SDK version. 此選項可讓您在 -f|--framework 選項指定的 Framework 之外,選取特定的 Framework 版本。This option enables you to select a specific framework version beyond the framework specified by the -f|--framework option.


顯示說明資訊。Shows help information.

-o|--output <OUTPUT_DIRECTORY>

指定執行階段套件存放區的路徑。Specifies the path to the runtime package store. 如未指定,則預設為使用者設定檔 .NET Core 安裝目錄的 store 子目錄。If not specified, it defaults to the store subdirectory of the user profile .NET Core installation directory.


略過最佳化階段。Skips the optimization phase.


略過符號產生。Skips symbol generation. 目前,只能在 Windows 和 Linux 產生符號。Currently, you can only generate symbols on Windows and Linux.

-v|--verbosity <LEVEL>

設定命令的詳細資訊層級。Sets the verbosity level of the command. 允許的值為 q[uiet]m[inimal]n[ormal]d[etailed]diag[nostic]Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].


命令使用的工作目錄。The working directory used by the command. 如未指定,則使用目前目錄的 obj 子目錄。If not specified, it uses the obj subdirectory of the current directory.


儲存 .NET Core 2.0.0 的 packages.csproj 專案中指定的套件:Store the packages specified in the packages.csproj project file for .NET Core 2.0.0:

dotnet store --manifest packages.csproj --framework-version 2.0.0

儲存 packages.csproj 中指定的套件,不需要最佳化:Store the packages specified in the packages.csproj without optimization:

dotnet store --manifest packages.csproj --skip-optimization

另請參閱See also