| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /ProgramData/chocolatey/extensions/chocolatey-visualstudio/ |
Upload File : |
function Get-VSChannelReference
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory = $true)] [ValidateSet('2017', '2019', '2022')] [string] $VisualStudioYear,
[bool] $Preview,
[hashtable] $PackageParameters
)
$channelId = $null
$channelUri = $null
$installChannelUri = $null
if ($null -ne $PackageParameters)
{
if ($PackageParameters.ContainsKey('channelId'))
{
$channelId = $PackageParameters['channelId']
}
if ($PackageParameters.ContainsKey('channelUri'))
{
$channelUri = $PackageParameters['channelUri']
}
if ($PackageParameters.ContainsKey('installChannelUri'))
{
$installChannelUri = $PackageParameters['installChannelUri']
}
}
if ($null -eq $channelId)
{
switch ($VisualStudioYear)
{
'2017' { $majorVersion = 15 }
'2019' { $majorVersion = 16 }
'2022' { $majorVersion = 17 }
default { throw "Unsupported VisualStudioYear: $VisualStudioYear"}
}
$mapPreviewOrReleaseToChannelTypeSuffix = @{ $true = 'Preview'; $false = 'Release' }
$channelId = 'VisualStudio.{0}.{1}' -f $majorVersion, $mapPreviewOrReleaseToChannelTypeSuffix[$Preview]
}
if ($null -eq $channelUri)
{
$channelUri = Get-VSChannelUri -ChannelId $channelId -ErrorAction SilentlyContinue
}
$obj = New-VSChannelReference -ChannelId $channelId -ChannelUri $channelUri -InstallChannelUri $installChannelUri
return $obj
}