@@ -38,9 +38,9 @@ task compile -depends clean {
3838 $buildParam = @ { $true = " " ; $false = " --version-suffix=$buildSuffix " }[$tag -ne $NULL -and $revision -ne " local" ]
3939 $packageParam = @ { $true = " " ; $false = " --version-suffix=$suffix " }[$tag -ne $NULL -and $revision -ne " local" ]
4040
41- echo " build: Tag is $tag "
42- echo " build: Package version suffix is $suffix "
43- echo " build: Build version suffix is $buildSuffix "
41+ Write-Output " build: Tag is $tag "
42+ Write-Output " build: Package version suffix is $suffix "
43+ Write-Output " build: Build version suffix is $buildSuffix "
4444
4545 # restore all project references (creating project.assets.json for each project)
4646 exec { dotnet restore $base_dir \AutoMapper.Collection.sln / nologo }
@@ -60,29 +60,30 @@ task test {
6060
6161function Install-Dotnet
6262{
63- $dotnetcli = where - is(' dotnet' )
63+ $dotnetCli = (where - is " dotnet" | Select-Object - First 1 )
64+ $install = ($null -eq $dotnetCli -or ($null -ne $env: DOTNET_CLI_VERSION -and $null -eq (& " $dotnetCli " -- info | Where-Object { $_ -like " $env: DOTNET_CLI_VERSION *" })))
6465
65- if ( $dotnetcli -eq $null )
66- {
66+ if ( $install )
67+ {
6768 $dotnetPath = " $pwd \.dotnet"
68- $dotnetCliVersion = if ($env: DOTNET_CLI_VERSION -eq $null ) { ' Latest' } else { $env: DOTNET_CLI_VERSION }
69- $dotnetInstallScriptUrl = ' https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0 /scripts/obtain/install.ps1'
70- $dotnetInstallScriptPath = ' .\scripts\obtain\install.ps1'
69+ $dotnetCliVersion = if ($null -eq $env: DOTNET_CLI_VERSION ) { ' Latest' } else { $env: DOTNET_CLI_VERSION }
70+ $dotnetInstallScriptUrl = ' https://raw.githubusercontent.com/dotnet/cli/v2.1.4 /scripts/obtain/dotnet- install.ps1'
71+ $dotnetInstallScriptPath = ' .\scripts\obtain\dotnet- install.ps1'
7172
72- md - Force " .\scripts\obtain\" | Out-Null
73- curl $dotnetInstallScriptUrl - OutFile $dotnetInstallScriptPath
74- & .\scripts\obtain\install.ps1 - Channel " preview" - version $dotnetCliVersion - InstallDir $dotnetPath - NoPath
73+ mkdir - Force " .\scripts\obtain\" | Out-Null
74+ Invoke-WebRequest $dotnetInstallScriptUrl - OutFile $dotnetInstallScriptPath
75+ & .\scripts\obtain\dotnet - install.ps1 - Channel " preview" - version $dotnetCliVersion - InstallDir $dotnetPath - NoPath
7576 $env: Path = " $dotnetPath ;$env: Path "
7677 }
7778}
7879
7980function where-is ($command ) {
80- (ls env:\path).Value.split(' ;' ) | `
81- where { $_ } | `
82- % { [System.Environment ]::ExpandEnvironmentVariables($_ ) } | `
83- where { test-path $_ } |`
84- % { ls " $_ \*" - include * .bat, * .exe, * cmd } | `
85- % { $file = $_.Name ; `
81+ (Get-ChildItem env:\path).Value.split(' ;' ) | `
82+ Where-Object { $_ } | `
83+ ForEach-Object { [System.Environment ]::ExpandEnvironmentVariables($_ ) } | `
84+ Where-Object { test-path $_ } |`
85+ ForEach-Object { Get-ChildItem " $_ \*" - include * .bat, * .exe, * cmd } | `
86+ ForEach-Object { $file = $_.Name ; `
8687 if ($file -and ($file -eq $command -or `
8788 $file -eq ($command + ' .exe' ) -or `
8889 $file -eq ($command + ' .bat' ) -or `
@@ -91,5 +92,5 @@ function where-is($command) {
9192 $_.FullName `
9293 } `
9394 } | `
94- select - unique
95+ Select-Object - unique
9596}
0 commit comments