当前位置: 动力学知识库 > 问答 > 编程问答 >

install NuGet via PowerShell script

问题描述:

As far as I can tell , NuGet is meant to be installed as a Visual Studio extension :

http://docs.nuget.org/docs/start-here/installing-nuget

But what if I need NuGet on a machine that doesn't have VS installed ?

Specifically, I would like to install NuGet via a PowerShell script.

网友答案:

Here's a short PowerShell script to do what you probably expect:

$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$targetNugetExe = "$rootPath\nuget.exe"
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
Set-Alias nuget $targetNugetExe -Scope Global -Verbose

Note that Invoke-WebRequest cmdlet arrived with PowerShell v3.0. This article gives the idea.

网友答案:

Without having Visual Studio, you can grab Nuget from: http://nuget.org/nuget.exe

For command-line executions using this, check out: http://docs.nuget.org/docs/reference/command-line-reference

With respect to Powershell, just copy the nuget.exe to the machine. No installation required, just execute it using commands from the above documentation.

分享给朋友:
您可能感兴趣的文章:
随机阅读: