diff --git a/chocolatey-visualstudio.extension/extensions/Install-VSInstaller.ps1 b/chocolatey-visualstudio.extension/extensions/Install-VSInstaller.ps1 index 915fff17..5e29e134 100644 --- a/chocolatey-visualstudio.extension/extensions/Install-VSInstaller.ps1 +++ b/chocolatey-visualstudio.extension/extensions/Install-VSInstaller.ps1 @@ -84,6 +84,21 @@ function Install-VSInstaller return } + # if installing from layout, check for existence of vs_installer.opc and auto add --offline + if (-not $packageParameters.ContainsKey('offline')) + { + $layoutPath = Resolve-VSLayoutPath -PackageParameters $PackageParameters + if ($layoutPath -ne $null) + { + $installerOpcPath = Join-Path -Path $layoutPath -ChildPath 'vs_installer.opc' + if (Test-Path -Path $installerOpcPath) + { + Write-Debug "Using the VS Installer package present in the layout path: $installerOpcPath" + $packageParameters['offline'] = $installerOpcPath + } + } + } + if ($packageParameters.ContainsKey('bootstrapperPath')) { $installerFilePath = $packageParameters['bootstrapperPath'] @@ -112,21 +127,6 @@ function Install-VSInstaller $PackageParameters.Remove($parameterToRemove) } - # if installing from layout, check for existence of vs_installer.opc and auto add --offline - if (-not $packageParameters.ContainsKey('offline')) - { - $layoutPath = Resolve-VSLayoutPath -PackageParameters $PackageParameters - if ($layoutPath -ne $null) - { - $installerOpcPath = Join-Path -Path $layoutPath -ChildPath 'vs_installer.opc' - if (Test-Path -Path $installerOpcPath) - { - Write-Debug "Using the VS Installer package present in the layout path: $installerOpcPath" - $packageParameters['offline'] = $installerOpcPath - } - } - } - # --update must be last $packageParameters['quiet'] = $null $silentArgs = ConvertTo-ArgumentString -Arguments $packageParameters -FinalUnstructuredArguments @('--update') -Syntax 'Willow' diff --git a/chocolatey-visualstudio.extension/extensions/Install-VisualStudio.ps1 b/chocolatey-visualstudio.extension/extensions/Install-VisualStudio.ps1 index 7b129165..61927316 100644 --- a/chocolatey-visualstudio.extension/extensions/Install-VisualStudio.ps1 +++ b/chocolatey-visualstudio.extension/extensions/Install-VisualStudio.ps1 @@ -122,8 +122,6 @@ Install-ChocolateyPackage Write-Debug "Log file path: $logFilePath" } - $silentArgs = Generate-InstallArgumentsString -parameters $packageParameters -adminFile $adminFile -logFilePath $logFilePath -assumeNewVS2017Installer:$assumeNewVS2017Installer - if ($creatingLayout) { $layoutPath = $packageParameters['layout'] @@ -135,6 +133,19 @@ Install-ChocolateyPackage Assert-VSInstallerUpdated -PackageName $PackageName -PackageParameters $PackageParameters -ProductReference $productReference -Url $Url -Checksum $Checksum -ChecksumType $ChecksumType } + if ($packageParameters.ContainsKey('bootstrapperPath')) + { + $installerFilePath = $packageParameters['bootstrapperPath'] + $packageParameters.Remove('bootstrapperPath') + Write-Debug "User-provided bootstrapper path: $installerFilePath" + } + else + { + $installerFilePath = $null + } + + $silentArgs = Generate-InstallArgumentsString -parameters $packageParameters -adminFile $adminFile -logFilePath $logFilePath -assumeNewVS2017Installer:$assumeNewVS2017Installer + $arguments = @{ packageName = $PackageName silentArgs = $silentArgs diff --git a/chocolatey-visualstudio.extension/extensions/Start-VisualStudioModifyOperation.ps1 b/chocolatey-visualstudio.extension/extensions/Start-VisualStudioModifyOperation.ps1 index abbad048..918f55d4 100644 --- a/chocolatey-visualstudio.extension/extensions/Start-VisualStudioModifyOperation.ps1 +++ b/chocolatey-visualstudio.extension/extensions/Start-VisualStudioModifyOperation.ps1 @@ -242,6 +242,21 @@ throw 'The Visual Studio Installer is not present. Unable to continue.' } + # TODO: Resolve-VSLayoutPath and auto add --installLayoutPath + + $blacklist = @('bootstrapperPath') + $parametersToRemove = $argumentSet.Keys | Where-Object { $blacklist -contains $_ } + foreach ($parameterToRemove in $parametersToRemove) + { + if ($parameterToRemove -eq $null) + { + continue + } + + Write-Debug "Filtering out package parameter not passed to the VS Installer: '$parameterToRemove'" + $argumentSet.Remove($parameterToRemove) + } + $silentArgs = ConvertTo-ArgumentString -InitialUnstructuredArguments @($Operation) -Arguments $argumentSet -Syntax 'Willow' $exitCode = -1 if ($PSCmdlet.ShouldProcess("Executable: $($installer.Path)", "Start with arguments: $silentArgs"))