Skip to content

Commit

Permalink
chocolatey-visualstudio.extension: Install-VisualStudio: allow (opt-i…
Browse files Browse the repository at this point in the history
…n) updating of VS 2017 products

Very naive/work in progress for now.
  • Loading branch information
jberezanski committed Mar 26, 2018
1 parent 9ca4283 commit cba9636
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ Install-ChocolateyPackage
[ValidateSet('MsiVS2015OrEarlier', 'WillowVS2017OrLater')] [string] $InstallerTechnology,
[string] $ProgramsAndFeaturesDisplayName = $ApplicationName,
[string] $VisualStudioYear,
[string] $Product
[string] $Product,
[switch] $AllowUpdate
)
if ($Env:ChocolateyPackageDebug -ne $null)
{
$VerbosePreference = 'Continue'
$DebugPreference = 'Continue'
Write-Warning "VerbosePreference and DebugPreference set to Continue due to the presence of ChocolateyPackageDebug environment variable"
}
Write-Debug "Running 'Install-VisualStudio' for $PackageName with ApplicationName:'$ApplicationName' Url:'$Url' Checksum:$Checksum ChecksumType:$ChecksumType InstallerTechnology:'$InstallerTechnology' ProgramsAndFeaturesDisplayName:'$ProgramsAndFeaturesDisplayName' VisualStudioYear:'$VisualStudioYear' Product:'$Product'";
Write-Debug "Running 'Install-VisualStudio' for $PackageName with ApplicationName:'$ApplicationName' Url:'$Url' Checksum:$Checksum ChecksumType:$ChecksumType InstallerTechnology:'$InstallerTechnology' ProgramsAndFeaturesDisplayName:'$ProgramsAndFeaturesDisplayName' VisualStudioYear:'$VisualStudioYear' Product:'$Product' AllowUpdate:'$AllowUpdate'";

$packageParameters = Parse-Parameters $env:chocolateyPackageParameters
$creatingLayout = $packageParameters.ContainsKey('layout')
Expand All @@ -66,7 +67,15 @@ Install-ChocolateyPackage
Write-Verbose ("Found {0} installed Visual Studio product(s) with ChannelId = {1} and ProductId = {2}" -f $productsCount, $prodRef.ChannelId, $prodRef.ProductId)
if ($productsCount -gt 0)
{
Write-Warning "$ApplicationName is already installed. Please use the Visual Studio Installer to modify or repair it."
if ($AllowUpdate)
{
Start-VisualStudioModifyOperation -PackageName $PackageName -ArgumentList @() -VisualStudioYear $VisualStudioYear -ApplicableProducts @($Product) -OperationTexts @('update', 'updating', 'update') -Operation 'update'
}
else
{
Write-Warning "$ApplicationName is already installed. Please use the Visual Studio Installer to modify or repair it."
}

return
}
}
Expand Down

0 comments on commit cba9636

Please sign in to comment.