簡體   English   中英

如何使用 Powershell 強制 Nuget 還原?

[英]How to force Nuget Restore using Powershell?

我想強制 NuGet 恢復我的 NuGet 包。 轉到我的解決方案目錄並鍵入NuGet restore ,即使使用最新下載的NuGet.exe也不起作用。

正如這里所解釋的,我可以在 Powershell 提示符下使用Update-Package命令執行此操作(因為我不喜歡使用我的 Visual Studio 環境)。

但是,我的 Powershell 似乎不理解Update-Package ,雖然我有一個 +5 版本:

PowerShell Prompt> Get-Host | Select-Object Version

Version
-------
5.1.19041.1023


PowerShell Prompt> Update-Package -reinstall
Update-Package : The term 'Update-Package' is not recognized as the name of a cmdlet, function,
script file, or operable program.
Check the spelling of the name, or if a path was included, verify that 
the path is correct and try again.
At line:1 char:1
+ Update-Package -reinstall
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Update-Package:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

為了在我的 Powershell 中成功啟動Update-Package ,我該怎么做?

提前致謝

我不使用更新包,但以下內容:

 & "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" /t:restore  C:\code\projectdirectory

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM