Skip to content

Commit

Permalink
Skip the preview feed if not on a preview .NET (#1957)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow authored Feb 17, 2022
1 parent 44f3c84 commit 4201400
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion scripts/azure-templates-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ jobs:
- pwsh: .\scripts\select-vs.ps1
displayName: Select Visual Studio
- ${{ if not(endsWith(parameters.name, '_linux')) }}:
- pwsh: .\scripts\install-dotnet-workloads.ps1 -InstallDir "$env:AGENT_TOOLSDIRECTORY/dotnet" -SourceUrl "$env:DOTNET_WORKLOAD_SOURCE"
- pwsh: .\scripts\install-dotnet-workloads.ps1 -InstallDir "$env:AGENT_TOOLSDIRECTORY/dotnet" -SourceUrl "$env:DOTNET_WORKLOAD_SOURCE" -IsPreview $true
condition: ne(variables.DOTNET_VERSION_PREVIEW, '')
displayName: Install the preview .NET Core workloads
- pwsh: .\scripts\install-dotnet-workloads.ps1 -InstallDir "$env:AGENT_TOOLSDIRECTORY/dotnet" -SourceUrl "$env:DOTNET_WORKLOAD_SOURCE" -IsPreview $false
condition: eq(variables.DOTNET_VERSION_PREVIEW, '')
displayName: Install the .NET Core workloads
# display dotnet info
- pwsh: dotnet --info
Expand Down
10 changes: 8 additions & 2 deletions scripts/install-dotnet-workloads.ps1
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
Param(
[string] $InstallDir,
[string] $SourceUrl
[string] $SourceUrl,
[boolean] $IsPreview = $true
)

$ErrorActionPreference = 'Stop'

$env:DOTNET_ROOT="$InstallDir"

$previewFeed = 'https://api.nuget.org/v3/index.json'
if ($IsPreview) {
$previewFeed = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json'
}

Write-Host "Installing workloads..."
& dotnet workload install `
android ios tvos macos maccatalyst wasm-tools maui `
--from-rollback-file $SourceUrl `
--source https://api.nuget.org/v3/index.json `
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json
--source $previewFeed

exit $LASTEXITCODE

0 comments on commit 4201400

Please sign in to comment.