我可以在以下位置找到 NuGet.psd1 文件:
C:\Program Files (x86)\Microsoft Visual Studio
12.0\Common7\IDE\Extensions\5ttpefif.3mk\Modules\NuGet\NuGet.psd1.
但是,当您尝试加载它时:
PS> Import-Module $pathToNuGetPsd1 -Force -NoClobber -Scope Global
Import-Module : The name of the current Windows PowerShell host is: 'ConsoleHost'.
The module 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\
Extensions\5ttpefif.3mk\Modules\NuGet\NuGet.psd1' requires the following Windows
PowerShell host: 'Package Manager Host'.
我认为我们不走运。它必须从包管理器主机运行,并且需要来自 Visual Studio 的东西,如 Matt 所述。
为了解决我的问题,我使用 Chocolatey 安装 NuGet.CommandLine,然后使用 NuGet.bat 来完成我需要的操作。它需要做更多的工作,并且可能并非在所有情况下都有效,具体取决于您要执行的操作。
巧克力:https ://github.com/chocolatey/chocolatey/wiki/Installation
NuGet.命令行:
PS> cinst NuGet.CommandLine