Skip to content

Commit b121c41

Browse files
committed
removed manual .net install
1 parent e26cf16 commit b121c41

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

app/Wissance.Zerial/Wissance.Zerial.Installer/Zerial/tools/chocolateyinstall.ps1

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
33
$url = 'https://github.com/Wissance/Zerial/raw/master/app/Wissance.Zerial/Wissance.Zerial.Installer/Windows/Wissance.Zerial.WinInstaller.Bootstrap.X86.exe' # download url, HTTPS preferred
44
$url64 = 'https://github.com/Wissance/Zerial/raw/master/app/Wissance.Zerial/Wissance.Zerial.Installer/Windows/Wissance.Zerial.WinInstaller.Bootstrap.X64.exe' # 64bit URL here (HTTPS preferred) or remove - if installer contains both (very rare), use $url
5-
$dotnetPath = $Env:SystemDrive + "\'Program Files'\dotnet\"
65

76
$packageArgs = @{
87
packageName = $env:ChocolateyPackageName
@@ -21,10 +20,10 @@ $packageArgs = @{
2120
silentArgs = "/SILENT /qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`"" # ALLUSERS=1 DISABLEDESKTOPSHORTCUT=1 ADDDESKTOPICON=0 ADDSTARTMENU=0
2221
validExitCodes= @(0, 3010, 1641)
2322
}
23+
# skip dotnet install if there is a newer version
24+
$dotnetVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\dotnet\Setup\InstalledVersions\x64" -Name "MostRecentVersion" -ErrorAction SilentlyContinue).MostRecentVersion
25+
if ($dotnetVersion -and [version]$dotnetVersion -ge [version]"6.0.0") {
26+
Write-Host ".NET $dotnetVersion was already installed"
27+
$installDotnet = $false
2428

25-
Set-ExecutionPolicy Bypass -Scope Process
26-
Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile "dotnet-install.ps1"
27-
powershell ".\dotnet-install.ps1 -InstallDir $dotnetPath -Runtime dotnet -Version 6.0.27"
28-
29-
$env:Path += '$dotnetPath'
3029
Install-ChocolateyPackage @packageArgs

0 commit comments

Comments
 (0)