Skip to content

Commit

Permalink
use nuget 5.9.1 for azure pipelines (dotnet#7608)
Browse files Browse the repository at this point in the history
  • Loading branch information
v-pegao authored Sep 10, 2021
1 parent 4e32077 commit 2e0c96e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions azure-pipelines-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ steps:

- task: NuGetToolInstaller@1
displayName: 'Use NuGet'
inputs:
versionSpec: 5.9.1

- task: CmdLine@1
displayName: 'npm install'
Expand Down
2 changes: 2 additions & 0 deletions azure-pipelines-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ steps:

- task: NuGetToolInstaller@1
displayName: 'Use NuGet'
inputs:
versionSpec: 5.9.1

- task: CmdLine@1
displayName: 'npm install'
Expand Down
17 changes: 12 additions & 5 deletions pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ else{

$os = GetOperatingSystemName
Write-Host "Running on OS $os"
$globalNugetCommand = 'nuget'
$nugetCommand = GetNuGetCommand ($os)
$scriptPath = $MyInvocation.MyCommand.Path
$scriptHome = Split-Path $scriptPath
Expand All @@ -39,13 +40,19 @@ if (-not(ValidateCommand("dotnet"))) {
}

# Check if nuget.exe exists
if (-not(ValidateCommand($nugetCommand))) {
if (ValidateCommand($globalNugetCommand)) {
$nugetCommand = $globalNugetCommand
} elseIf (-not(ValidateCommand($nugetCommand))) {
Write-Host "Downloading NuGet.exe..."
mkdir -Path "$env:LOCALAPPDATA/Nuget" -Force
$ProgressPreference = 'SilentlyContinue'
[Net.WebRequest]::DefaultWebProxy.Credentials = [Net.CredentialCache]::DefaultCredentials
Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile $nugetCommand

# Pin Nuget version to v5.9.1 to workaround for Nuget issue: https://github.com/NuGet/Home/issues/11125
# Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile $nugetCommand
Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/v5.9.1/nuget.exe' -OutFile $nugetCommand
}
Write-Host "Using Nuget Command: $nugetCommand, $(& $nugetCommand help | Select -First 1)"

# dotnet pack first
foreach ($proj in (Get-ChildItem -Path ("src", "plugins") -Include *.[cf]sproj -Exclude 'docfx.msbuild.csproj' -Recurse)) {
Expand Down Expand Up @@ -101,9 +108,9 @@ $packages = @{
"nuspecs" = @("src/nuspec/YamlSplitter/YamlSplitter.nuspec");
};
"SandcastleRefMapper" = @{
"proj" = $null;
"nuspecs" = @("src/nuspec/SandcastleRefMapper/SandcastleRefMapper.nuspec")
};
"proj" = $null;
"nuspecs" = @("src/nuspec/SandcastleRefMapper/SandcastleRefMapper.nuspec")
};
}

# Pack plugins and tools
Expand Down

0 comments on commit 2e0c96e

Please sign in to comment.