![](/img/trans.png)
[英]Artifactory restore nuget packages with authentication from powershell
[英]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
标准 powershell 不提供 NuGet 还原功能。
如果您参考https:\/\/docs.microsoft.com\/en-us\/nuget\/consume-packages\/install-use-packages-visual-studio<\/a>和https:\/\/docs.microsoft.com\/en-us\/nuget \/consume-packages\/package-restore<\/a> ,你会看到有 5 种方式使用 NuGet。
powershell 中没有内置功能。
您唯一的选择是在上述工具的基础上进行构建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.