cake-build / cake-build/cake

Msbuild.exe found in Env:Path instead of nuget.exe

Open
#1,430 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
3h 37m
Merged PRs (30d)
21

Description

### What You Are Seeing?
I have setup a new Cake project using the bootstrapper script `Invoke-WebRequest http://cakebuild.net/download/bootstrapper/windows -OutFile build.ps1`

When I try to run the build.ps1 script I get a nuget restore error which is due to nuget.exe not being found. Instead msbuild.exe is found in the line 135 of build.ps1

`$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) }
Write-Verbose "paths $existingPaths"
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1`

### What is Expected?
No matches should be found if nuget.exe does not exist in any of the env:Paths and it should be downloaded

### What version of Cake are you using?
0.17.0
### Are you running on a 32 or 64 bit system?
64bit

### What environment are you running on? Windows? Linux? Mac?
Windows 7

### Are you running on a CI Server? If so, which one?
No

### How Did You Get This To Happen? (Steps to Reproduce)
Run bootstrapper
`Invoke-WebRequest http://cakebuild.net/download/bootstrapper/windows -OutFile build.ps1`

Run build.ps1

`./build.ps1`

### Output Log

> An error occured while restoring NuGet tools.
> At D:\dev\e360\build.ps1:172 char:9
> + Throw "An error occured while restoring NuGet tools."
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + CategoryInfo : OperationStopped: (An error occure...ng NuGet tools.:String) [], RuntimeException
> + FullyQualifiedErrorId : An error occured while restoring NuGet tools.

Contributor guide

Open the contributing guide

Research direction

Start with build.ps1 around line 135 and review how the Env:Path entries are searched for nuget.exe. Reproduce the issue by downloading the Windows bootstrapper and running ./build.ps1; done means an absent nuget.exe is not treated as a match and the script proceeds to download it.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.