使用套件還原還原套件Restore packages using Package Restore

為了提倡更乾淨的開發環境,以及降低存放庫大小,NuGet 套件還原 會依專案檔或 packages.config 中所列,安裝專案的所有相依性。To promote a cleaner development environment and to reduce repository size, NuGet Package Restore installs all of a project's dependencies listed in either the project file or packages.config. .NET Core 2.0+ dotnet builddotnet run 命令會執行自動套件還原。The .NET Core 2.0+ dotnet build and dotnet run commands do an automatic package restore. Visual Studio 可以在建置專案時自動還原套件,您可以隨時透過 Visual Studio、nuget restoredotnet restore 和 Mono 上的 xbuild 來還原套件。Visual Studio can restore packages automatically when it builds a project, and you can restore packages at any time through Visual Studio, nuget restore, dotnet restore, and xbuild on Mono.

套件還原會確認專案的所有相依性都可用,而不必將它們儲存在原始檔控制中。Package Restore makes sure that all a project's dependencies are available, without having to store them in source control. 若要設定原始程式碼控制存放庫以排除套件二進位檔,請參閱套件和原始檔控制To configure your source control repository to exclude the package binaries, see Packages and source control.

套件還原概觀Package Restore overview

套件還原會先視需要安裝專案的直接相依性,然後在整個相依性關係圖中安裝那些套件的任何相依性。Package Restore first installs the direct dependencies of a project as needed, then installs any dependencies of those packages throughout the entire dependency graph.

如果尚未安裝套件,NuGet 會先嘗試從快取中擷取它。If a package isn't already installed, NuGet first attempts to retrieve it from the cache. 如果套件不在快取中,則 nuget 會嘗試從 [ 工具 > 選項 ] > nuget 封裝管理員 > 套件來源 的清單中的所有已啟用來源下載套件 Visual Studio。If the package isn't in the cache, NuGet tries to download the package from all enabled sources in the list at Tools > Options > NuGet Package Manager > Package Sources in Visual Studio. 在還原程序中,NuGet 會忽略套件來源的順序,且使用任一個最先回應要求的來源。During restore, NuGet ignores the order of package sources, and uses the package from whichever source is first to respond to requests. 如需 NuGet 運作方式的詳細資訊,請參閱常用的 NuGet 組態For more information about how NuGet behaves, see Common NuGet configurations.

注意

在所有來源檢查完畢前,NuGet 不會指出還原套件失敗。NuGet doesn't indicate a failure to restore a package until all the sources have been checked. 到那時候,NuGet 只會針對清單中的最後一個來源回報失敗。At that time, NuGet reports a failure for only the last source in the list. 這項錯誤表示套件未出現在其他「任何」來源上,即使那些來源都未個別出現錯誤亦然。The error implies that the package wasn't present on any of the other sources, even though errors aren't shown for each of those sources individually.

還原套件Restore packages

套件還原會嘗試將所有套件相依性安裝到符合專案檔 ( .csproj ) 或您的 packages.config 檔案中套件參考的正確狀態。Package Restore tries to install all package dependencies to the correct state matching the package references in your project file ( .csproj ) or your packages.config file. (在 Visual Studio 中,參考會出現在 [方案總管] 的 [相依性 \ NuGet] 或 [參考] 節點下。)(In Visual Studio, the references appear in Solution Explorer under the Dependencies \ NuGet or the References node.)

  1. 如果專案檔中的套件參考是正確的,請使用您慣用的工具來還原套件。If the package references in your project file are correct, use your preferred tool to restore packages.

    如果專案檔 ( .csproj ) 或您的 packages.config 檔案中的套件參考不正確 (不符合您在套件還原之後所需的狀態),則您需要改為安裝套件或更新套件。If the package references in your project file ( .csproj ) or your packages.config file are incorrect (they do not match your desired state following Package Restore), then you need to either install or update packages instead.

    針對使用 PackageReference 的專案,在成功還原之後,套件應該會出現在 [global-packages] 資料夾中,而且 obj/project.assets.json 檔案會重新建立。For projects using PackageReference, after a successful restore, the package should be present in the global-packages folder and the obj/project.assets.json file is recreated. 針對使用 packages.config 的專案,套件應該會出現在專案的 packages 資料夾中。For projects using packages.config, the package should appear in the project's packages folder. 專案現在應可順利建置。The project should now build successfully.

  2. 如果您在執行套件還原之後,仍然遇到缺少套件或套件相關的問題 (例如 Visual Studio 方案總管中的錯誤圖示),建議您遵循對套件還原錯誤進行疑難排解中的指示,或者重新安裝並更新套件After running Package Restore, if you still experience missing packages or package-related errors (such as error icons in Solution Explorer in Visual Studio), you may need to follow instructions described in Troubleshooting Package Restore errors or, alternatively, reinstall and update packages.

    在 Visual Studio 中,套件管理員主控台提供幾個彈性的選項來重新安裝套件。In Visual Studio, the Package Manager Console provides several flexible options for reinstalling packages. 請參閱使用 Package-UpdateSee Using Package-Update.

使用 Visual Studio 進行還原Restore using Visual Studio

在 Windows 的 Visual Studio 中:In Visual Studio on Windows, either:

  • 自動還原套件,或Restore packages automatically, or

  • 手動還原套件Restore packages manually

使用 Visual Studio 自動還原套件Restore packages automatically using Visual Studio

套件還原會在您從範本建立專案或建置專案時自動進行,且受限於啟用和停用套件還原中的選項。Package Restore happens automatically when you create a project from a template or build a project, subject to the options in Enable and disable package restore. 在 NuGet 4.0+ 中,還原也會在您變更 SDK 樣式專案 (通常是 .NET Core 或 .NET Standard 專案) 時自動進行。In NuGet 4.0+, restore also happens automatically when you make changes to a SDK-style project (typically a .NET Core or .NET Standard project).

  1. 選擇 [ 工具 > 選項 ] > NuGet 封裝管理員 ,然後在 [ 套件還原 ] 下的 Visual Studio 中選取 [在 組建期間自動檢查遺漏的套件 ],以啟用自動套件還原。Enable automatic package restore by choosing Tools > Options > NuGet Package Manager , and then selecting Automatically check for missing packages during build in Visual Studio under Package Restore.

    針對非 SDK 樣式的專案,您必須先選取 [允許 NuGet 下載遺漏的套件 ] 以啟用自動還原選項。For non-SDK-style projects, you first need to select Allow NuGet to download missing packages to enable the automatic restore option.

  2. 建置專案。Build the project.

    如果一或多個個別套件仍未正確安裝,則 [方案總管] 會顯示錯誤圖示。If one or more individual packages still aren't installed properly, Solution Explorer shows an error icon. 以滑鼠右鍵按一下並選取 [管理 NuGet 套件],且使用 [套件管理員] 先解除安裝再重新安裝受影響的套件。Right-click and select Manage NuGet Packages , and use Package Manager to uninstall and reinstall the affected packages. 如需詳細資訊,請參閱重新安裝及更新套件For more information, see Reinstall and update packages

    如果您看到「此專案參考這部電腦上所缺少的 NuGet 套件」或「一或多個 NuGet 套件需要還原,但因未獲同意而無法進行」錯誤,請啟用自動還原If you see the error "This project references NuGet package(s) that are missing on this computer," or "One or more NuGet packages need to be restored but couldn't be because consent has not been granted," enable automatic restore. 針對較舊的專案,另請參閱移轉至自動套件還原For older projects, also see Migrate to automatic package restore. 另請參閱 套件還原疑難排解Also see Package Restore troubleshooting.

使用 Visual Studio 手動還原套件Restore packages manually using Visual Studio

  1. 選擇 [ 工具 > 選項 ] > NuGet 封裝管理員 來啟用套件還原。Enable package restore by choosing Tools > Options > NuGet Package Manager. 在 [套件還原] 選項下,選取 [允許 NuGet 下載遺漏的套件]。Under Package Restore options, select Allow NuGet to download missing packages.

  2. 在 [方案總管] 中,請以滑鼠右鍵按一下解決方案,然後選取 [還原 NuGet 套件]。In Solution Explorer , right click the solution and select Restore NuGet Packages.

    如果一或多個個別套件仍未正確安裝,則 [方案總管] 會顯示錯誤圖示。If one or more individual packages still aren't installed properly, Solution Explorer shows an error icon. 以滑鼠右鍵按一下並選取 [管理 NuGet 套件],然後使用 [套件管理員] 先解除安裝再重新安裝受影響的套件。Right-click and select Manage NuGet Packages , and then use Package Manager to uninstall and reinstall the affected packages. 如需詳細資訊,請參閱重新安裝及更新套件For more information, see Reinstall and update packages

    如果您看到「此專案參考這部電腦上所缺少的 NuGet 套件」或「一或多個 NuGet 套件需要還原,但因未獲同意而無法進行」錯誤,請啟用自動還原If you see the error "This project references NuGet package(s) that are missing on this computer," or "One or more NuGet packages need to be restored but couldn't be because consent has not been granted," enable automatic restore. 針對較舊的專案,另請參閱移轉至自動套件還原For older projects, also see Migrate to automatic package restore. 另請參閱 套件還原疑難排解Also see Package Restore troubleshooting.

在 Visual Studio 中啟用及停用套件還原Enable and disable package restore in Visual Studio

在 Visual Studio 中,您主要是透過 [ 工具 > 選項 ] > NuGet 封裝管理員 來控制套件還原:In Visual Studio, you control Package Restore primarily through Tools > Options > NuGet Package Manager :

透過 NuGet 套件管理員選項控制套件還原

  • 允許 NuGet 下載遺漏的套件 會藉由變更 NuGet.Config 檔案 (在 Windows 上為 %AppData%\NuGet\,在 Mac/Linux 上則為 ~/.nuget/NuGet/) packageRestore 區段packageRestore/enabled 設定,控制所有形式的套件還原。Allow NuGet to download missing packages controls all forms of package restore by changing the packageRestore/enabled setting in the packageRestore section of the NuGet.Config file, at %AppData%\NuGet\ on Windows, or ~/.nuget/NuGet/ on Mac/Linux. 此設定也會啟用 Visual Studio 中解決方案操作功能表上的 [還原 NuGet 套件] 命令。This setting also enables the Restore NuGet Packages command on the solution's context menu in Visual Studio, .

    <configuration>
        <packageRestore>
            <!-- The 'enabled' key is True when the "Allow NuGet to download missing packages" checkbox is set.
                 Clearing the box sets this to False, disabling command-line, automatic, and MSBuild-integrated restore. -->
            <add key="enabled" value="True" />
        </packageRestore>
    </configuration>
    

    注意

    在啟動 Visual Studio 或啟動組建之前,若要全域覆寫 packageRestore/enabled 設定,可以用值 True 或 False 來設定 EnableNuGetPackageRestore 環境變數。To globally override the packageRestore/enabled setting, set the environment variable EnableNuGetPackageRestore with a value of True or False before launching Visual Studio or starting a build.

  • 在 Visual Studio 建置期間自動檢查遺漏的套件 會藉由變更 NuGet.Config 檔案 packageRestore 區段中的 packageRestore/automatic 設定來控制自動還原。Automatically check for missing packages during build in Visual Studio controls automatic restore by changing the packageRestore/automatic setting in the packageRestore section of the NuGet.Config file. 將此選項設為 True 時,從 Visual Studio 中執行組建會自動還原任何遺漏的套件。When this option is set to True, running a build from Visual Studio automatically restores any missing packages. 此設定不會影響從 MSBuild 命令列執行的組建。This setting doesn't affect builds run from the MSBuild command line.

    ...
    <configuration>
        <packageRestore>
            <!-- The 'automatic' key is set to True when the "Automatically check for missing packages during
                 build in Visual Studio" checkbox is set. Clearing the box sets this to False and disables
                 automatic restore. -->
            <add key="automatic" value="True" />
        </packageRestore>
    </configuration>
    

若要針對電腦上的所有使用者啟用或停用套件還原,開發人員或公司可以將組態設定新增到全域 nuget.config 檔案。To enable or disable Package Restore for all users on a computer, a developer or company can add the configuration settings to the global nuget.config file. 全域 nuget.config 是在 Windows 中的 %ProgramData%\NuGet\Config,有時在特定 \{IDE}\{Version}\{SKU}\ Visual Studio 資料夾中,或在 Mac/Linux 的 ~/.local/shareThe global nuget.config is in Windows at %ProgramData%\NuGet\Config, sometimes under a specific \{IDE}\{Version}\{SKU}\ Visual Studio folder, or in Mac/Linux at ~/.local/share. 個別使用者接著可以視需要選擇性地啟用專案層級的還原。Individual users can then selectively enable restore as needed on a project level. 如需 NuGet 如何排定多個組態檔優先順序的詳細資料,請參閱常見的 NuGet 行為For more details on how NuGet prioritizes multiple config files, see Common NuGet configurations.

重要

如果您 packageRestore 直接在中編輯設定 nuget.config ,請重新開機 Visual Studio,如此 [ 選項 ] 對話方塊就會顯示目前的值。If you edit the packageRestore settings directly in nuget.config, restart Visual Studio, so that the Options dialog box shows the current values.

選擇預設封裝管理格式Choose default package management format

透過 NuGet 封裝管理員選項來控制預設封裝管理格式

NuGet 有兩種格式,可供專案使用套件: PackageReferencepackages.configNuGet has two formats in which a project may use packages: PackageReference and packages.config. 您可以從 套件管理 標題底下的下拉式清單中選取預設格式。The default format can be selected from the drop-down under the Package Management heading. 也可以使用在專案中安裝第一個套件時的提示選項。An option to be prompted when the first package is installed in a project is also available.

注意

如果專案不支援這兩種套件管理格式,則使用的封裝管理格式將會是與專案相容的格式,因此可能不是選項中的預設設定。If a project does not support both package management formats, the package management format used will be the one that's compatible with the project, and therefore may not be the default set in the options. 此外,即使在 [選項] 視窗中選取了選項,NuGet 也不會在第一次安裝套件時提示您選擇。Additionally, NuGet will not prompt for selection on first package installation, even if the option is selected in the options window.

如果使用封裝管理員主控台在專案中安裝第一個套件,即使在 [選項] 視窗中選取選項,NuGet 也不會提示選擇格式。If Package Manager Console is used to install the first package in a project, NuGet will not prompt for format selection, even if the option is selected in the options window.

使用 dotnet CLI 進行還原Restore using the dotnet CLI

使用 dotnet restore 命令來還原專案檔 (請參閱 PackageReference) 中所列的套件。Use the dotnet restore command, which restores packages listed in the project file (see PackageReference). 使用 .NET Core 2.0 和更新版本時,會使用 dotnet builddotnet run 自動完成還原。With .NET Core 2.0 and later, restore is done automatically with dotnet build and dotnet run. 截至 NuGet 4.0,這會執行與 nuget restore 相同的程式碼。As of NuGet 4.0, this runs the same code as nuget restore.

如同其他 dotnet CLI 命令,請先開啟命令列並切換至包含您專案檔的目錄。As with the other dotnet CLI commands, first open a command line and switch to the directory that contains your project file.

使用 dotnet restore 還原套件:To restore a package using dotnet restore:

dotnet restore 

重要

若要將遺漏的套件參考新增至專案檔,請使用 dotnet add package,這也會執行 restore 命令。To add a missing package reference to the project file, use dotnet add package, which also runs the restore command.

使用 nuget.exe CLI 進行還原Restore using the nuget.exe CLI

使用 restore 命令,它會下載並安裝 packages 資料夾遺漏的任何套件。Use the restore command, which downloads and installs any packages missing from the packages folder.

針對移轉至 PackageReference 的專案,請改為使用 msbuild -t:restore 來還原套件。For projects migrated to PackageReference, use msbuild -t:restore to restore packages instead.

restore 只會將套件新增至磁碟,但不會變更專案的相依性。restore only adds packages to disk but does not change a project's dependencies. 若要還原專案相依性,請修改 packages.config,然後使用 restore 命令。To restore project dependencies, modify packages.config, then use the restore command.

如同其他 nuget.exe CLI 命令,請先開啟命令列並切換至包含您專案檔的目錄。As with the other nuget.exe CLI commands, first open a command line and switch to the directory that contains your project file.

使用 restore 還原套件:To restore a package using restore:

nuget restore MySolution.sln

重要

restore 命令不會修改專案檔或 packages.config 。若要加入相依性,請在 Visual Studio 中透過封裝管理員 UI 或主控台加入封裝,或修改 packages.config 然後執行 installrestoreThe restore command does not modify a project file or packages.config. To add a dependency, either add a package through the Package Manager UI or Console in Visual Studio, or modify packages.config and then run either install or restore.

使用 MSBuild 進行還原Restore using MSBuild

若要使用 PackageReference 來還原專案檔中所列的套件,請使用 msbuild -t:restore 命令。To restore packages listed in the project file with PackageReference, use the the msbuild -t:restore command. 這個命令只適用於 NuGet 4.x+ 和 MSBuild 15.1+ (兩者均隨附於 Visual Studio 2017 和更新版本)。This command is available only in NuGet 4.x+ and MSBuild 15.1+, which are included with Visual Studio 2017 and higher versions. nuget restoredotnet restore 都會將這個命令用於適用的專案。Both nuget restore and dotnet restore use this command for applicable projects.

  1. 開啟開發人員命令提示字元 (在 [搜尋] 方塊中,輸入 開發人員命令提示字元 )。Open a Developer command prompt (In the Search box, type Developer command prompt ).

    您通常想要從 [開始] 功能表啟動適用於 Visual Studio 的開發人員命令提示字元,因為它將使用適用於 MSBuild 的所有必要路徑來設定。You typically want to start the Developer Command Prompt for Visual Studio from the Start menu, as it will be configured with all the necessary paths for MSBuild.

  2. 切換至包含專案檔的資料夾,並輸入下列命令。Switch to the folder containing the project file and type the following command.

    # Uses the project file in the current folder by default
    msbuild -t:restore
    
  3. 輸入下列命令以重建專案。Type the following command to rebuild the project.

    msbuild
    

    確定 MSBuild 輸出會指出組建已順利完成。Make sure that the MSBuild output indicates that the build completed successfully.

注意

msbuild 具有 -restore 會執行 Restore 、重載專案,然後建立的參數。msbuild has a -restore switch which will run Restore, reload the project, and then build. 請參閱 使用一個 MSBuild 命令來還原和建立See Restoring and building with one MSBuild command.

# Will restore the project, then build, since build is the default target.
msbuild -restore

使用 Azure Pipelines 進行還原Restore using Azure Pipelines

在 Azure Pipelines 中建立組建定義時,在定義中於任何建置工作之前包含 NuGet 還原或 .NET Core 還原工作。When you create a build definition in Azure Pipelines, include the NuGet restore or .NET Core restore task in the definition before any build tasks. 根據預設,一些建置範本已包含還原工作。Some build templates include the restore task by default.

使用 Azure DevOps Server 進行還原Restore using Azure DevOps Server

Azure DevOps Server 和 TFS 2013 及更新版本會在建置期間自動還原套件,前提是您使用 TFS 2013 或更新版本的 Team Build 範本。Azure DevOps Server and TFS 2013 and later automatically restore packages during build, if you're using a TFS 2013 or later Team Build template. 針對較舊的 TFS 版本,您可以包含一個建置步驟來執行命令列還原選項,或選擇性地將建置範本移轉至較新版本。For earlier TFS versions, you can include a build step to run a command-line restore option, or optionally migrate the build template to a later version. 如需詳細資訊,請參閱使用 Team Foundation Build 的套件還原設定For more information, see Set up package restore with Team Foundation Build.

使用還原來限制套件版本Constrain package versions with restore

NuGet 透過任何方法還原套件時,會使用 packages.config 或專案檔中所指定的任何條件約束:When NuGet restores packages through any method, it honors any constraints you specified in packages.config or the project file:

  • packages.config 中,您可以在相依性的 allowedVersion 屬性中指定版本範圍。In packages.config, you can specify a version range in the allowedVersion property of the dependency. 如需詳細資訊,請參閱限制升級版本See Constrain upgrade versions for more information. 例如:For example:

    <package id="Newtonsoft.json" version="6.0.4" allowedVersions="[6,7)" />
    
  • 在專案檔中,您可以使用 PackageReference 來直接指定相依性的範圍。In a project file, you can use PackageReference to specify a dependency's range directly. 例如:For example:

    <PackageReference Include="Newtonsoft.json" Version="[6, 7)" />
    

在所有情況下,都請使用套件版本控制中所述的標記法。In all cases, use the notation described in Package versioning.

強制從套件來源還原Force restore from package sources

根據預設,NuGet 還原作業會使用來自 global-packageshttp-cache 資料夾的套件,這在 管理全域套件和快取資料夾中有描述。By default, NuGet restore operations use packages from the global-packages and http-cache folders, which are described in Manage the global packages and cache folders.

若要避免使用 global-packages 資料夾,請執行下列任一步驟:To avoid using the global-packages folder, do one of the following:

  • 使用 nuget locals global-packages -cleardotnet nuget locals global-packages --clear 清除資料夾。Clear the folder using nuget locals global-packages -clear or dotnet nuget locals global-packages --clear.
  • 使用下列其中一種方法,在還原作業之前暫時變更 全域套件 資料夾的位置:Temporarily change the location of the global-packages folder before the restore operation, using one of the following methods:
    • 將 NUGET_PACKAGES 環境變數設定為不同資料夾。Set the NUGET_PACKAGES environment variable to a different folder.
    • 建立將 globalPackagesFolder (如果使用 PackageReference) 或 repositoryPath (如果使用 packages.config) 設定為不同資料夾的 NuGet.Config 檔案。Create a NuGet.Config file that sets globalPackagesFolder (if using PackageReference) or repositoryPath (if using packages.config) to a different folder. 如需詳細資訊,請參閱組態設定For more information, see configuration settings.
    • 僅限 MSBuild:請使用屬性指定不同的資料夾 RestorePackagesPathMSBuild only: Specify a different folder with the RestorePackagesPath property.

若要避免使用 HTTP 來源的快取,請執行下列任一步驟:To avoid using the cache for HTTP sources, do one of the following:

  • 使用 -NoCache 選項搭配 nuget restore,或 --no-cache 選項搭配 dotnet restoreUse the -NoCache option with nuget restore, or the --no-cache option with dotnet restore. 這些選項不會影響透過 Visual Studio 套件管理員或主控台進行的還原作業。These options don't affect restore operations through the Visual Studio Package Manager or console.
  • 使用 nuget locals http-cache -cleardotnet nuget locals http-cache --clear清除快取。Clear the cache using nuget locals http-cache -clear or dotnet nuget locals http-cache --clear.
  • 暫時將 NUGET_HTTP_CACHE_PATH 環境變數設定為不同資料夾。Temporarily set the NUGET_HTTP_CACHE_PATH environment variable to a different folder.

遷移至自動套件還原 (Visual Studio)Migrate to automatic package restore (Visual Studio)

針對 NuGet 2.6 和更早版本,先前支援的 MSBuild 整合套件還原已不再適用。For NuGet 2.6 and earlier, an MSBuild-integrated package restore was previously supported but that is no longer true. (通常是在 Visual Studio 中以滑鼠右鍵按一下解決方案,然後選取 [啟用 NuGet 套件還原] 來啟用)。(It was typically enabled by right-clicking a solution in Visual Studio and selecting Enable NuGet Package Restore ). 如果您的專案是使用整合 MSBuild 套件還原,請遷移至自動套件還原。If your project uses the deprecated MSBuild-integrated package restore, please migrate to automatic package restore.

使用 MSBuild-Integrated 套件還原的專案通常會包含包含三個檔案的 . nuget 資料夾: NuGet.confignuget.exenuget.exeProjects that use MSBuild-Integrated package restore typically contain a .nuget folder with three files: NuGet.config , nuget.exe , and NuGet.targets. 存在 nuget .targets 檔案時,會判斷 nuget 是否會繼續使用 MSBuild 整合的方法,因此必須在遷移期間移除此檔案。The presence of a NuGet.targets file determines whether NuGet will continue to use the MSBuild-integrated approach, so this file must be removed during the migration.

若要遷移至自動套件還原:To migrate to automatic package restore:

  1. 關閉 Visual Studio。Close Visual Studio.
  2. 刪除 .nuget/nuget.exe.nuget/NuGet.targetsDelete .nuget/nuget.exe and .nuget/NuGet.targets.
  3. 針對每個專案檔,移除 <RestorePackages> 元素,並移除任何對 NuGet.targets 的參考。For each project file, remove the <RestorePackages> element and remove any reference to NuGet.targets.

若要測試自動套件還原:To test the automatic package restore:

  1. 將 [packages] 資料夾從解決方案中移除。Remove the packages folder from the solution.

  2. 在 Visual Studio 中開啟方案,並啟動建置。Open the solution in Visual Studio and start a build.

    自動套件還原應該會下載並安裝每個相依性套件,而不會將他們新增至原始檔控制。Automatic package restore should download and install each dependency package, without adding them to source control.

疑難排解Troubleshooting

請參閱針對套件還原進行疑難排解See Troubleshoot package restore.