[Windows] Docker, .NET Core and NPM improvements (#3811)

* improve InitializeVM script

* Update windows2019.json

* remove configs

* resolve comments

* resolve comments; fix order

* fix templates

* move Node.js packages to toolset

* dotnet warmup and merge docker scripts

* Update Node.Tests.ps1

* Update Install-Docker.ps1

* fix node.js tests

* fix npm package installation

* Update Install-NodeLts.ps1

* fix tests

* fix test
This commit is contained in:
Maxim Lobanov
2021-08-01 15:10:59 +03:00
committed by GitHub
parent b28c62d3f1
commit 892ada55d5
11 changed files with 81 additions and 83 deletions

View File

@@ -12,16 +12,26 @@ Set-SystemVariable -SystemVariable DOTNET_MULTILEVEL_LOOKUP -Value "0"
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
$templates = @(
'console',
'mstest',
'web',
'mvc',
'webapi'
)
function Invoke-Warmup (
$SdkVersion
) {
# warm up dotnet for first time experience
$projectTypes = @('console', 'mstest', 'web', 'mvc', 'webapi')
$projectTypes | ForEach-Object {
$template = $_
$projectPath = Join-Path -Path C:\temp -ChildPath $template
New-Item -Path $projectPath -Force -ItemType Directory
Push-Location -Path $projectPath
& $env:ProgramFiles\dotnet\dotnet.exe new globaljson --sdk-version "$sdkVersion"
& $env:ProgramFiles\dotnet\dotnet.exe new $template
Pop-Location
Remove-Item $projectPath -Force -Recurse
}
}
function InstallSDKVersion (
$sdkVersion
$SdkVersion,
$Warmup
)
{
if (!(Test-Path -Path "C:\Program Files\dotnet\sdk\$sdkVersion"))
@@ -40,16 +50,8 @@ function InstallSDKVersion (
$sdkTargetsPath = "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets"
Start-DownloadWithRetry -Url $sdkTargetsUrl -DownloadPath $sdkTargetsPath -Name $sdkTargetsName
# warm up dotnet for first time experience
$templates | ForEach-Object {
$template = $_
$projectPath = Join-Path -Path C:\temp -ChildPath $template
New-Item -Path $projectPath -Force -ItemType Directory
Push-Location -Path $projectPath
& $env:ProgramFiles\dotnet\dotnet.exe new globaljson --sdk-version "$sdkVersion"
& $env:ProgramFiles\dotnet\dotnet.exe new $template
Pop-Location
Remove-Item $projectPath -Force -Recurse
if ($Warmup) {
Invoke-Warmup -SdkVersion $SdkVersion
}
}
@@ -57,7 +59,9 @@ function InstallAllValidSdks()
{
# Consider all channels except preview/eol channels.
# Sort the channels in ascending order
$dotnetVersions = (Get-ToolsetContent).dotnet.versions
$dotnetToolset = (Get-ToolsetContent).dotnet
$dotnetVersions = $dotnetToolset.versions
$warmup = $dotnetToolset.warmup
# Download installation script.
$installationName = "dotnet-install.ps1"
@@ -93,7 +97,7 @@ function InstallAllValidSdks()
elseif (!$release.'sdk'.'version'.Contains('-'))
{
$sdkVersion = $release.'sdk'.'version'
InstallSDKVersion -sdkVersion $sdkVersion
InstallSDKVersion -SdkVersion $sdkVersion -Warmup $warmup
}
}
}