11# ## Constants ###
2- $DefaultMSBuildVersion = ' 16 '
2+ $DefaultMSBuildVersion = ' 17 '
33$DefaultConfiguration = ' debug'
44$NuGetClientRoot = Split-Path - Path $PSScriptRoot - Parent
55$CLIRoot = Join-Path $NuGetClientRoot ' cli'
@@ -95,7 +95,7 @@ Function Get-LatestVisualStudioRoot {
9595
9696Function Get-MSBuildExe {
9797 param (
98- [ValidateSet (" 15" , " 16" , $null )]
98+ [ValidateSet (" 15" , " 16" , " 17 " , $null )]
9999 [string ]$MSBuildVersion
100100 )
101101
@@ -406,8 +406,6 @@ Function Install-NuGet {
406406
407407 $NuGetFolderPath = Split-Path - Path $NuGetExe - Parent
408408 $NuGetInstalledMarker = Join-Path $NuGetFolderPath " .marker.v1"
409- $CredentialProviderDir = Join-Path $NuGetFolderPath " credprovider"
410- $CredentialProviderPath = Join-Path $CredentialProviderDir " plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe"
411409
412410 if (Test-Path $NuGetInstalledMarker ) {
413411 Trace-Log " nuget.exe is already installed"
@@ -418,30 +416,10 @@ Function Install-NuGet {
418416 if (-not (Test-Path $NuGetFolderPath )) {
419417 New-Item $NuGetFolderPath - Type Directory | Out-Null
420418 }
421-
422- $CredentialProviderBundle = (Join-Path $NuGetClientRoot ' .nuget\Microsoft.NuGet.CredentialProvider.zip' )
423-
424- Trace-Log ' Downloading Azure Artifacts Credential Provider'
425- Invoke-WebRequest `
426- https:// github.com / microsoft/ artifacts- credprovider/ releases/ download/ 0.1 .18 / Microsoft.NuGet.CredentialProvider.zip `
427- - UseBasicParsing `
428- - OutFile $CredentialProviderBundle
429-
430- if (Test-Path $CredentialProviderDir ) {
431- Remove-Item $CredentialProviderDir - Recurse - Force
432- }
433-
434- Trace-Log ' Extracting Azure Artifacts Credential Provider'
435- & $7zipExe x $CredentialProviderBundle " -o$CredentialProviderDir " " -y"
436- if ($LASTEXITCODE -ne 0 ) {
437- throw " 7-zip failed to extract $CredentialProviderBundle "
438- }
439-
440- Remove-Item $CredentialProviderBundle
441419
442420 Trace-Log ' Downloading nuget.exe'
443421 Invoke-WebRequest `
444- https:// dist.nuget.org/ win- x86- commandline/ v6.0.0 - preview4 / nuget.exe `
422+ https:// dist.nuget.org/ win- x86- commandline/ v6.2.1 / nuget.exe `
445423 - UseBasicParsing `
446424 - OutFile $NuGetExe
447425
@@ -451,36 +429,14 @@ Function Install-NuGet {
451429 if (Test-Path $NuGetExe ) {
452430 Remove-Item $NuGetExe - Recurse - Force
453431 }
454- if (Test-Path $CredentialProviderDir ) {
455- Remove-Item $CredentialProviderDir - Recurse - Force
456- }
457- if (Test-Path $NuGetInstalledMarker ) {
458- Remove-Item $NuGetInstalledMarker - Recurse - Force
459- }
460432 throw ;
461433 } finally {
462434 $progressPreference = ' Continue'
463435 }
464436 }
465-
466- if (-not (Test-Path $CredentialProviderPath )) {
467- throw " No file exists at the expected credential provider path: $CredentialProviderPath "
468- }
469-
470437 if (-not (Test-Path $NuGetExe )) {
471438 throw " No file exists at the expected nuget.exe path: $NuGetExe "
472439 }
473-
474- Trace-Log " Setting NuGet .NET Framework credential path"
475- $env: NUGET_NETFX_PLUGIN_PATHS = $CredentialProviderPath
476- $env: NUGET_PLUGIN_PATHS = $CredentialProviderPath
477-
478- # This is a mitigation for rampant timeouts from the credential provider.
479- # See https://github.com/NuGet/Home/issues/7842#issuecomment-531059076
480- $timeoutInSeconds = 30
481- Trace-Log " Increasing NuGet plug-in timeout values to $timeoutInSeconds seconds."
482- $env: NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = $timeoutInSeconds
483- $env: NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = $timeoutInSeconds
484440}
485441
486442Function Configure-NuGetCredentials {
0 commit comments