Skip to content

A Swiss Army knife for developers.

updated init.ps1

Etienne Baudoux0a763ab8c3c5
diff --git a/init.ps1 b/init.ps1
index 1fcd0aa22..8108bd168 100644
--- a/init.ps1
+++ b/init.ps1
@@ -13,16 +13,6 @@ Function Restore-PackagesUnder($searchRoot) {
Write-Host "Restoring packages for $($_.FullName)..." -ForegroundColor $HeaderColor
& "$toolsPath\Restore-NuGetPackages.ps1" -Path $_.FullName -Verbosity $nugetVerbosity -MSBuildPath $MSBuildPath
}
-
- # Restore vcxproj dependencies
- $nugetPath = & "$PSScriptRoot\tools\Get-NuGetTool.ps1"
- Get-ChildItem $searchRoot -rec |? { $_.FullName.EndsWith('.vcxproj') } |% {
- $packages = Join-Path -Path $_.PSParentPath -ChildPath "nuget.config"
- if (Test-Path $packages) {
- Write-Host "Restoring packages for $(Convert-Path $_.PSParentPath)..." -ForegroundColor $HeaderColor
- & $nugetPath restore $(Convert-Path $_.PSParentPath)
- }
- }
}
Push-Location $PSScriptRoot
@@ -34,7 +24,6 @@ try {
$MSBuildPath = Get-MsBuildPath
if ($VerbosePreference -eq 'continue') { $nugetVerbosity = 'Detailed' }
- & "$PSScriptRoot\tools\Get-NuGetTool.ps1" | Out-Null
Restore-PackagesUnder "$PSScriptRoot\src"
Write-Host "Successfully restored all dependencies" -ForegroundColor Yellow
diff --git a/tools/Get-NuGetTool.ps1 b/tools/Get-NuGetTool.ps1
deleted file mode 100644
index 4f640959e..000000000
--- a/tools/Get-NuGetTool.ps1
+++ /dev/null
@@ -1,35 +0,0 @@
-<#
-.SYNOPSIS
- Downloads the NuGet.exe tool and returns the path to it.
-.PARAMETER NuGetVersion
- The version of the NuGet tool to acquire.
-#>
-Param(
- [Parameter()]
- [string]$NuGetVersion='5.2.0'
-)
-
-# Value is documented here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms723207(v=vs.85).aspx
-$YesToAllOnAnyDialogs = 16
-
-function Expand-ZIPFile($file, $destination) {
- if (!(Test-Path $destination)) { $null = mkdir $destination }
- $shell = new-object -com shell.application
- $zip = $shell.NameSpace((Resolve-Path $file).Path)
- foreach ($item in $zip.items()) {
- $shell.Namespace((Resolve-Path $destination).Path).copyhere($item, $YesToAllOnAnyDialogs) | Out-Null
- }
-}
-
-$binaryToolsBasePath = "$env:localappdata\Temp"
-$binaryToolsPath = "$binaryToolsBasePath\$NuGetVersion"
-if (!(Test-Path $binaryToolsPath)) { $null = mkdir $binaryToolsPath }
-$nugetPath = "$binaryToolsPath\nuget.exe"
-
-# Ignore the nuget.exe that came in the bundle and use the version we want to use.
-if (!(Test-Path $nugetPath)) {
- Write-Host "Downloading nuget.exe $NuGetVersion..." -ForegroundColor Yellow
- (New-Object System.Net.WebClient).DownloadFile("https://dist.nuget.org/win-x86-commandline/v$NuGetVersion/NuGet.exe", $nugetPath)
-}
-
-$nugetPath
diff --git a/tools/Restore-NuGetPackages.ps1 b/tools/Restore-NuGetPackages.ps1
index 72e1aaa55..1a5e675a4 100644
--- a/tools/Restore-NuGetPackages.ps1
+++ b/tools/Restore-NuGetPackages.ps1
@@ -25,12 +25,9 @@ Param(
)
if ($Path.EndsWith('.sln')) {
- if ($PSCmdlet.ShouldProcess($Path, 'dotnet restore')) {
- Write-Verbose "Restoring NuGet packages for $Path with verbosity $Verbosity"
- dotnet restore $Path -v $Verbosity
- Invoke-Expression '& "$MSBuildPath" $Path /t:restore /v:$Verbosity'
- if ($lastexitcode -ne 0) { throw }
- }
+ Write-Verbose "Restoring NuGet packages for $Path with verbosity $Verbosity"
+ Invoke-Expression '& "$MSBuildPath" $Path /t:restore /v:$Verbosity'
+ if ($lastexitcode -ne 0) { throw }
$slnDir = Split-Path -Path $Path -Parent
$packagesConfig = Join-Path $slnDir "\nuget.config"