-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Land #51, update dotnet 4.5 to restore chocolatey
- Loading branch information
Showing
7 changed files
with
87 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
function Invoke-CLR4PowerShellCommand { | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory=$true)] | ||
[ScriptBlock] | ||
$ScriptBlock, | ||
|
||
[Parameter(ValueFromRemainingArguments=$true)] | ||
[Alias('Args')] | ||
[object[]] | ||
$ArgumentList | ||
) | ||
|
||
if ($PSVersionTable.CLRVersion.Major -eq 4) { | ||
Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $ArgumentList | ||
return | ||
} | ||
|
||
$RunActivationConfigPath = $Env:TEMP | Join-Path -ChildPath ([Guid]::NewGuid()) | ||
New-Item -Path $RunActivationConfigPath -ItemType Container | Out-Null | ||
@" | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup useLegacyV2RuntimeActivationPolicy="true"> | ||
<supportedRuntime version="v4.0"/> | ||
</startup> | ||
</configuration> | ||
"@ | Set-Content -Path $RunActivationConfigPath\powershell.exe.activation_config -Encoding UTF8 | ||
|
||
$EnvVarName = 'COMPLUS_ApplicationMigrationRuntimeActivationConfigPath' | ||
$EnvVarOld = [Environment]::GetEnvironmentVariable($EnvVarName) | ||
[Environment]::SetEnvironmentVariable($EnvVarName, $RunActivationConfigPath) | ||
|
||
try { | ||
& powershell.exe -inputformat text -command $ScriptBlock -args $ArgumentList | ||
} finally { | ||
[Environment]::SetEnvironmentVariable($EnvVarName, $EnvVarOld) | ||
$RunActivationConfigPath | Remove-Item -Recurse | ||
} | ||
|
||
} | ||
|
||
$ErrorActionPreference = 'Stop' | ||
Set-StrictMode -Version Latest | ||
|
||
$isWin8 = wmic os get caption | find /i '" 8 "' | ||
$isWin2012 = wmic os get caption | find /i '" 2012 "' | ||
|
||
# skip wrapping for 8 or 2012? | ||
if ($isWin8 -or $isWin2012){ | ||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | ||
}else{ | ||
Invoke-CLR4PowerShellCommand -ScriptBlock { | ||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | ||
} | ||
} | ||
|
||
# cribbed from https://gist.github.com/jstangroome/882528 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$Logfile = "C:\Windows\Temp\dotnet-install.log" | ||
function LogWrite { | ||
Param ([string]$logstring) | ||
$now = Get-Date -format s | ||
Add-Content $Logfile -value "$now $logstring" | ||
Write-Host $logstring | ||
} | ||
|
||
LogWrite "Downloading dotNet 4.5.1" | ||
try { | ||
(New-Object System.Net.WebClient).DownloadFile('http://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe', 'C:\Windows\Temp\dotnet.exe') | ||
} catch { | ||
LogWrite $_.Exception | Format-List -force | ||
LogWrite "Failed to download file." | ||
} | ||
|
||
LogWrite "Starting installation process..." | ||
try { | ||
Start-Process -FilePath "C:\Windows\Temp\dotnet.exe" -ArgumentList "/I /q /norestart" -Wait -PassThru | ||
} catch { | ||
LogWrite $_.Exception | Format-List -force | ||
LogWrite "Exception during install process." | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters