Skip to content

Commit

Permalink
Enhanced package update failure message on line 143 and added Reposit…
Browse files Browse the repository at this point in the history
…ory option to Install-Module command
  • Loading branch information
serkanz committed Jun 18, 2020
1 parent 6abf2e9 commit 7975481
Showing 1 changed file with 4 additions and 4 deletions.
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 '[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; 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

0 comments on commit 7975481

Please sign in to comment.