Fix typo in build.ps1 and use nuget.config (#1420)

* Fix typo in build.ps1

* Use nuget.config package sources in build.ps1

Installing a package within build.ps1 ignored the Src\nuget.config file, leading to failures depending on the machine configuration.
With this change, the script will successfully install the package it needs independent of machine configuration.

* Reuse existing variable to simplify script
This commit is contained in:
Andrew Arnott
2017-09-04 16:48:00 +12:00
committed by James Newton-King
parent e47282dad6
commit 42ccb6b1c0
+4 -4
View File
@@ -70,8 +70,8 @@ task Build -depends Clean {
mkdir "$buildDir\Temp" -Force
EnsureNuGetExists
EnsureNuGetPacakge "vswhere" $vswherePath $vswhereVersion
EnsureNuGetPacakge "NUnit.ConsoleRunner" $nunitConsolePath $nunitConsoleVersion
EnsureNuGetPackage "vswhere" $vswherePath $vswhereVersion
EnsureNuGetPackage "NUnit.ConsoleRunner" $nunitConsolePath $nunitConsoleVersion
$script:msBuildPath = GetMsBuildPath
Write-Host "MSBuild path $script:msBuildPath"
@@ -193,12 +193,12 @@ function EnsureNuGetExists()
}
}
function EnsureNuGetPacakge($packageName, $packagePath, $packageVersion)
function EnsureNuGetPackage($packageName, $packagePath, $packageVersion)
{
if (!(Test-Path $packagePath))
{
Write-Host "Couldn't find $packagePath. Downloading with NuGet"
exec { & $nugetPath install $packageName -OutputDirectory $buildDir\Temp -Version $packageVersion | Out-Default } "Error restoring $packagePath"
exec { & $nugetPath install $packageName -OutputDirectory $buildDir\Temp -Version $packageVersion -ConfigFile "$sourceDir\nuget.config" | Out-Default } "Error restoring $packagePath"
}
}