From 1eb4c2c21741da9489e9324c71ee171b363852b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bere=C5=BCa=C5=84ski?= Date: Sun, 19 Nov 2017 21:28:31 +0100 Subject: [PATCH] chocolatey-visualstudio.extension: use channelUri from detected VS instance, if present GitHub-Issue: GH-7 GH-8 GH-10 GH-26 --- .../Get-VSBootstrapperUrlFromChannelManifest.ps1 | 9 +++++++++ .../extensions/Get-VSProductReference.ps1 | 1 + .../extensions/Get-WillowInstalledProducts.ps1 | 1 + .../extensions/New-VSProductReference.ps1 | 4 +++- .../extensions/Start-VisualStudioModifyOperation.ps1 | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/chocolatey-visualstudio.extension/extensions/Get-VSBootstrapperUrlFromChannelManifest.ps1 b/chocolatey-visualstudio.extension/extensions/Get-VSBootstrapperUrlFromChannelManifest.ps1 index 85eda34f..00322006 100644 --- a/chocolatey-visualstudio.extension/extensions/Get-VSBootstrapperUrlFromChannelManifest.ps1 +++ b/chocolatey-visualstudio.extension/extensions/Get-VSBootstrapperUrlFromChannelManifest.ps1 @@ -26,6 +26,15 @@ function Get-VSBootstrapperUrlFromChannelManifest else { Write-Debug "Package parameters do not contain 'channelUri' or it is empty" + if ($ProductReference -ne $null -and -not [string]::IsNullOrEmpty($ProductReference.ChannelUri)) + { + $manifestUri = $ProductReference.ChannelUri + Write-Debug "Using manifest URI from the provided ProductReference: '$manifestUri'" + } + else + { + Write-Debug "ProductReference has not been provided or does not contain the channel manifest URI" + } } } diff --git a/chocolatey-visualstudio.extension/extensions/Get-VSProductReference.ps1 b/chocolatey-visualstudio.extension/extensions/Get-VSProductReference.ps1 index 51250cf5..90ab31d6 100644 --- a/chocolatey-visualstudio.extension/extensions/Get-VSProductReference.ps1 +++ b/chocolatey-visualstudio.extension/extensions/Get-VSProductReference.ps1 @@ -17,6 +17,7 @@ $props = @{ ChannelId = $channelId + ChannelUri = $null ProductId = $productId } diff --git a/chocolatey-visualstudio.extension/extensions/Get-WillowInstalledProducts.ps1 b/chocolatey-visualstudio.extension/extensions/Get-WillowInstalledProducts.ps1 index 67b90f36..dd5b8b18 100644 --- a/chocolatey-visualstudio.extension/extensions/Get-WillowInstalledProducts.ps1 +++ b/chocolatey-visualstudio.extension/extensions/Get-WillowInstalledProducts.ps1 @@ -19,6 +19,7 @@ installationPath = 'installationPath' installationVersion = 'installationVersion' channelId = 'channelId' + channelUri = 'channelUri' productId = 'product"\s*:\s*{\s*"id' enginePath = 'enginePath' } diff --git a/chocolatey-visualstudio.extension/extensions/New-VSProductReference.ps1 b/chocolatey-visualstudio.extension/extensions/New-VSProductReference.ps1 index 8bf5e21e..5a9766fa 100644 --- a/chocolatey-visualstudio.extension/extensions/New-VSProductReference.ps1 +++ b/chocolatey-visualstudio.extension/extensions/New-VSProductReference.ps1 @@ -4,11 +4,13 @@ function New-VSProductReference Param ( [Parameter(Mandatory = $true)] [string] $ChannelId, - [Parameter(Mandatory = $true)] [string] $ProductId + [Parameter(Mandatory = $true)] [string] $ProductId, + [string] $ChannelUri ) $props = @{ ChannelId = $ChannelId + ChannelUri = $ChannelUri ProductId = $ProductId } diff --git a/chocolatey-visualstudio.extension/extensions/Start-VisualStudioModifyOperation.ps1 b/chocolatey-visualstudio.extension/extensions/Start-VisualStudioModifyOperation.ps1 index ac2637d4..9483db22 100644 --- a/chocolatey-visualstudio.extension/extensions/Start-VisualStudioModifyOperation.ps1 +++ b/chocolatey-visualstudio.extension/extensions/Start-VisualStudioModifyOperation.ps1 @@ -194,7 +194,7 @@ $argumentSet = $baseArgumentSet.Clone() $argumentSet['installPath'] = $productInfo.installationPath - $argumentSet['__internal_productReference'] = New-VSProductReference -ChannelId $productInfo.channelId -ProductId $productInfo.productid + $argumentSet['__internal_productReference'] = New-VSProductReference -ChannelId $productInfo.channelId -ProductId $productInfo.productid -ChannelUri $productInfo.channelUri $argumentSets += $argumentSet } }