From 35add3b7bde79965bf25d27bc3cb4593cf7657f8 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Thu, 22 Feb 2018 10:37:11 +0000 Subject: [PATCH] (GH-1401) Added initial call to Chocolatey after installation - This ensures that all necessary setup is completed - Ready for further execution --- nuget/chocolatey/tools/chocolateysetup.psm1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nuget/chocolatey/tools/chocolateysetup.psm1 b/nuget/chocolatey/tools/chocolateysetup.psm1 index f9387b27fa..ebe83222ac 100644 --- a/nuget/chocolatey/tools/chocolateysetup.psm1 +++ b/nuget/chocolatey/tools/chocolateysetup.psm1 @@ -126,6 +126,7 @@ Creating Chocolatey folders if they do not already exist. Add-ChocolateyProfile Install-DotNet4IfMissing + Invoke-Chocolatey-Initial if ($env:ChocolateyExitCode -eq $null -or $env:ChocolateyExitCode -eq '') { $env:ChocolateyExitCode = 0 } @@ -700,4 +701,17 @@ param( } } +function Invoke-Chocolatey-Initial { + Write-Debug "Initializing Chocolatey files, etc by running Chocolatey..." + + try { + $chocoInstallationFolder = Get-ChocolateyInstallFolder + $chocoExe = Join-Path -Path $chocoInstallationFolder -ChildPath "choco.exe" + & $chocoExe | Out-Null + Write-Debug "Chocolatey execution completed successfully." + } catch { + Write-ChocolateyWarning "Unable to run Chocolately at this time. It is likely that .Net Framework installation requires a system reboot" + } +} + Export-ModuleMember -function Initialize-Chocolatey;