Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS 1.2 Support When Installing PackageManagement Module #1315

Merged
merged 7 commits into from
Jun 19, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private async Task CheckPackageManagement()
foreach (PSModuleInfo module in await _powerShellContextService.ExecuteCommandAsync<PSModuleInfo>(getModule))
{
// The user has a good enough version of PackageManagement
if(module.Version >= s_desiredPackageManagementVersion)
if (module.Version >= s_desiredPackageManagementVersion)
{
break;
}
Expand All @@ -100,7 +100,7 @@ private async Task CheckPackageManagement()
{
Message = "You have an older version of PackageManagement known to cause issues with the PowerShell extension. Would you like to update PackageManagement (You will need to restart the PowerShell extension after)?",
Type = MessageType.Warning,
Actions = new []
Actions = new[]
{
new MessageActionItem
{
Expand All @@ -118,7 +118,7 @@ private async Task CheckPackageManagement()
{
StringBuilder errors = new StringBuilder();
await _powerShellContextService.ExecuteScriptStringAsync(
"powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber'",
"powershell.exe -NoLogo -NoProfile -Command '[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber -Repository PSGallery'",
errors,
writeInputToHost: true,
writeOutputToHost: true,
Expand All @@ -140,7 +140,7 @@ await _powerShellContextService.ExecuteScriptStringAsync(
_languageServer.Window.ShowMessage(new ShowMessageParams
{
Type = MessageType.Error,
Message = "PackageManagement update failed. Please run the following command in a new Windows PowerShell session and then restart the PowerShell extension: `Install-Module PackageManagement -Force -AllowClobber -MinimumVersion 1.4.6`"
Message = "PackageManagement update failed. This might be due to PowerShell Gallery using TLS 1.2. More info can be found at https://aka.ms/psgallerytls"
});
}
}
Expand Down