psbuild
psbuild copied to clipboard
Nuget.exe download fails in GetPSBuild.ps1
Nuget.org throws a 401 unauthorized when I try to run GetPSBuild.ps1
Does the webclient need a user agent string?
PS C:> (new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/ligershark/psbuild/master/src/GetPSBuild.ps1") | iex Get-Nuget : Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (401) Unauthorized." At line:163 char:31
-
$nugetPath = (Get-Nuget -toolsDir $toolsDir -nugetDownloadUrl $n ... -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : NotSpecified: (:) [Get-Nuget], MethodInvocationException
- FullyQualifiedErrorId : WebException,Get-Nuget
psbuild not found, and was not downloaded successfully. sorry. Check your nuget.config (default path=C:\Users\jcarlson\AppData\Roaming\NuGet\NuGet.config) file to ensure that nuget.org is enabled. You can also try changing the versionToInstall value. You can file an issue at https://github.com/ligershark/psbuild/issues. At line:177 char:13
-
throw ("psbuild not found, and was not downloaded successfully. sorr ... -
- CategoryInfo : OperationStopped: (psbuild not fou...psbuild/issues.:String) [], RuntimeException - FullyQualifiedErrorId : psbuild not found, and was not downloaded successfully. sorry. Check your nuget.config (default path=C:\Users\jcarlson\AppData\Roaming\NuGet\NuGet.config) file to ensure that nuget.org is enabled. You can also try changing the versionToInstall value. You can file an issue at https://github.com/ligershark/psbuild/issues.
Its working for me both locally, as well as in CI. My CI builds for other projects call this on each build. Any idea how I can reproduce this? What happens if you paste http://nuget.org/nuget.exe into a browser window? Does the file get downloaded?
As a workaround until we can figure out what's happening, you can download the psbuild nuget pug and call Import-Module psbuild.psd1. The file is in the tools folder.
I ended up downloading nuget.exe from the browser like you said and placing it in the tools folder and then re-running the script which then completed the install. And I'm chalking it up to an issue with the firewall or network filter at my work because it worked from home on the first try. If I ever reproduce it I'll open another issue. Thanks for the tool and quick response.
@folding lets keep this open, I would like to fix the underlying issue when I have time. I think that I'll need to upgrade to using NuGet v3 client. When I do that I'd like to see if I can fix this. Reopening, when I make changes I'll update this issue. It may be a while before I do that though.