-
Notifications
You must be signed in to change notification settings - Fork 549
/
Copy pathinstall-dotnet-workloads.ps1
61 lines (53 loc) · 1.88 KB
/
install-dotnet-workloads.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Param(
[string] $SourceUrl = '',
[string] $InstallDir = '',
[string] $Tizen = '',
[boolean] $IsPreview = $false
)
$ErrorActionPreference = 'Stop'
if (!$Tizen) {
$Tizen = '<latest>'
}
$feed1 = 'https://api.nuget.org/v3/index.json'
$feed2 = 'https://api.nuget.org/v3/index.json'
$feed3 = 'https://api.nuget.org/v3/index.json'
if ($IsPreview) {
$feed1 = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json'
$feed2 = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json'
$feed3 = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json'
}
$Workloads = 'android','macos','wasm-tools'
if (!$IsLinux) {
$Workloads += 'ios','tvos','maccatalyst','maui'
}
if ($IsPreview) {
$Workloads += 'wasm-tools-net7'
} else {
$Workloads += 'wasm-tools-net6'
}
if ($SourceUrl) {
$Rollback = '--from-rollback-file',"$SourceUrl"
} elseif ($IsPreview) {
Write-Error "A preview workload install was requested, but no rollback file was provided. Specify the -SourceUrl."
exit 1
}
Write-Host "Installing .NET workloads..."
& dotnet workload install `
@Workloads `
@Rollback `
--source https://api.nuget.org/v3/index.json `
--source $feed1 `
--source $feed2 `
--source $feed3 `
--skip-sign-check `
--verbosity diagnostic
Write-Host "Installing Tizen workloads..."
New-Item -ItemType Directory -Force './output/tmp' | Out-Null
if ($IsLinux -or $IsMacOS) {
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.sh' -OutFile './output/tmp/workload-install.sh'
bash output/tmp/workload-install.sh --version "$Tizen"
} else {
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile './output/tmp/workload-install.ps1'
./output/tmp/workload-install.ps1 -Version "$Tizen"
}
exit $LASTEXITCODE