Open petermisovic opened 4 years ago
@petermisovic You can install PSScriptAnalyzer by using the following command in any PowerShell prompt.
Install-Module PSScriptAnalyzer
Can you enable logging in PoshTools and see if we can get an error message as to why it can't install it?
Click Tools->Options->PowerShell Tools->Diagnostics->Enable Logging
I'm getting the same error in both Visual Studio 2022 Community and Visual Studio 2019 Community. I'd really like to know what's causing this because I'm on a fresh install of Windows 10 Pro with minimal applications installed. I have both Powershell 5 and 7 installed. I can probably install it manually but I'd like to know the root cause of the error.
Here's a log:
[35] INFO PowerShellTools.Diagnostics.DiagnosticConfiguration (null) - Diagnostics enabled.
[35] INFO PowerShellTools.PowerShellToolsPackage (null) - PowerShellToolsPackage()
[35] INFO PowerShellTools.PowerShellToolsPackage (null) - InitializeAsync()
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Switch to main thread
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - PowerShell Tools Version: 5.7.14.0
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Visual Studio Version: 16.0
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Windows Version: Microsoft Windows NT 10.0.19044.0
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Current Culture: en-US
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Entering Initialize() of: PowerShellTools.PowerShellToolsPackage
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Adding language service
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Getting adapters factory
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - RefreshCommands
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Done RefreshCommands
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - InitializePowerShellHost
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Opening PowerShell host connection
[1] DEBUG PowerShellTools.ServiceManagement.PowershellHostProcessHelper (null) - Starting host path. Bitness: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
[1] DEBUG PowerShellTools.ServiceManagement.PowershellHostProcessHelper (null) - Host path: 'C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe' Host arguments: '-NoExit -NoProfile -NonInteractive -Command &{ Import-Module 'c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\3ajoktf3.5un\PowerShellProTools.VSCode.dll'; [PowerShellProTools.Common.ParentProcessWatcher]::WatchProcess(11656); }'
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - Initializing debugging engine service ...
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - Initializing run space with debugger
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - Providing $profile variable to the local runspace.
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - Done initializing runspace
[1] DEBUG PowerShellTools.ServiceManagement.PowershellHostProcessHelper (null) - Starting host path. Bitness: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
[1] DEBUG PowerShellTools.ServiceManagement.PowershellHostProcessHelper (null) - Host path: 'C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe' Host arguments: '-NoExit -NoProfile -NonInteractive -Command &{ Import-Module 'c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\3ajoktf3.5un\PowerShellProTools.VSCode.dll'; [PowerShellProTools.Common.ParentProcessWatcher]::WatchProcess(11656); }'
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Finished opening PowerShell host connection
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - Setting execution policy
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Initializing IntelliSense
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Debugger is ready
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Loading profiles
[12] INFO PowerShellTools.HostService.ServiceCommon (null) - Checking runspace availability: Available
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - Loading PowerShell Profiles
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Done loading profiles
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Set repl location to solution dir
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - Start executing ps script ...
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - DebuggerFinished
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - Clearing all breakpoints
[1] INFO PowerShellTools.HostService.ServiceCommon (null) - Checking runspace availability: Available
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Done InitializeInternal()
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - RegisterServices
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Done RegisterServices
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Set PacakgeInitialized
[1] INFO PowerShellTools.PowerShellToolsPackage (null) - Done InitializeAsync()
[9] DEBUG PowerShellTools.Classification.PowerShellTokenizationService (null) - Parsing input.
[9] DEBUG PowerShellTools.Classification.PowerShellTokenizationService (null) - Classifying tokens.
[9] DEBUG PowerShellTools.Classification.PowerShellTokenizationService (null) - Matching braces and regions.
[1] DEBUG PowerShellTools.Intellisense.IntelliSenseManager (null) - Non-VSStd2K command: 'CommandGroup: 4c7763bf-5faf-4264-a366-b7e1f27ba958, Id: 30'
[1] DEBUG PowerShellTools.Intellisense.IntelliSenseManager (null) - Non-VSStd2K command: 'CommandGroup: 1496a755-94de-11d0-8c3f-00c04fc2aae2, Id: 2200'
[1] DEBUG PowerShellTools.Intellisense.IntelliSenseManager (null) - Non-VSStd2K command: 'CommandGroup: 5efc7975-14bc-11cf-9b2b-00aa00573819, Id: 137'
[1] DEBUG PowerShellTools.Intellisense.IntelliSenseManager (null) - Non-VSStd2K command: 'CommandGroup: 5efc7975-14bc-11cf-9b2b-00aa00573819, Id: 137'
[1] DEBUG PowerShellTools.Intellisense.IntelliSenseManager (null) - Non-VSStd2K command: 'CommandGroup: 099073c0-b561-4bc1-a847-92657b89a00e, Id: 296'
Update. I wonder if this is the reason why the install is failing? I tried to install manually and received this message:
Maybe since the NuGet provider dependency isn't being met, the module install fails in Visual Studio. I'm going to install the NuGet provider and PSScriptAnalyzer manually now and hopefully that clears everything up.
Much more weirdness related to this problem. I did a manual install of PSScriptAnalyzer
in a Windows Powershell Admin prompt and it installed (Supposedly). But when I open Visual Studio and then go to View > PowerShell > Settings it still prompts for me to install PSScriptAnalyzer. So I went to Options > PowerShell Tools > Diagnostics and set Display PowerShell Window
to True
and Enable Diagnostic Logging
to True.
Then I restarted Visual Studio and got a PowerShell console to open on startup.
Check this out:
So for some reason it's not showing as installed. And apparently it wont install due to permission issues. But then if I run (Get-Module -ListAvailable).path
it shows up as installed, but only in the 32 bit module folder.
I am thoroughly confused and concerned my installation of PowerShell / windows is corrupt (I just did a fresh install of windows 10). Why are there two Windows Powershell directories with separate module paths?
C:\Program Files (x86)\WindowsPowerShell
C:\Program Files\WindowsPowerShell
Any help at all or clarification would be greatly appreciated.
Hello, I have the same problem!
Neither as an administrator nor standard user works. After restarting Visual Studio, the settings are rejected. Everyone on your homepage and here in the course of solutions fail. Adam is there a solution? Have the same environment described above. Thank you in advance
@ Sorry for the bad grammar comes from the translator.
Visual studio executed as administrator. As a standard user, it is not possible because administrator is required rights
Hello, I currently received license for Powershell Pro Tools and my intense was to configure PSScriptAnalyzer. But I'm always getting "Failed to install PSScriptAnalyzer error" dialog. Could you please help me? is there any way to install it separately? thanks!