Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip the preview feed if not on a preview .NET #1957

Merged
merged 2 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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