AndyVGa on Tue, 06 Dec 2016 20:35:39
I have an issue with Visual Studio 2015. Can't open Package Management Console because issues:
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3014) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3021) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3028) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3035) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The term 'Get-ExecutionPolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I found a lot of articles in the Internet, but nothing help!
Any advice or ideas?
Weiwei Cai on Wed, 07 Dec 2016 07:59:09
When do you get this exception, after installing Visual Studio 2015 or after using Visual Studio 2015 for a while?
If this issue occurs after using Visual Studio 2015 for a while, I suggest you uninstall and reinstall your NuGet Package Manager for Visual Studio 2015. And make sure you are installing the latest version (version 3.5) for your Visual Studio.
Then please also try open your PowerShell to test whether your PowerShell could working fine. This could help us confirm whether this issue caused by the NuGet Package Manager or the PowerShell.
If this issue occurs after installing VS2015, please make sure you have installed the latest version of Visual Studio 2015 (version 14.0.25431.01) and make sure your Windows has installed all Updates. Because there is a known bug for PowerShell on Windows 10.
And it also has some known issue on NuGet about ObjectSecurity exception. Please follow the solution discussed on this page.
AndyVGa on Wed, 07 Dec 2016 13:23:22
I have a version of Visual Studio 2015 Professional as 14.0.25431.01 Update 3.
The PowerShell console inside VS is working fine for me.
I have already installed NuGet 3.5 but it didn't work. Now I have a version 220.127.116.111. It is the latest one for an automatic installation with Extensions and Updates.
Also, I have modified the devenv.exe.config file as suggested. There is no result.
Updated NuGet to version 3.5 and it is no result again.
Weiwei Cai on Thu, 08 Dec 2016 08:04:40
Do you install nay PowerShell extensions for your Visual Studio 2015?
If installed, please try uninstall these PowerShell extensions for Visual Studio to check whether the issue causes by the extensions or not.
In addition, please try repair your Visual Studio 2015 to check whether there has any installation issue for your Visual Studio 2015.
AndyVGa on Fri, 09 Dec 2016 15:23:47
I have reinstalled everything from scratch last night.
I have Visual Studio Professional Version 14.0.25431.01 Update 3
I have NuGet Version 18.104.22.1686
I still have an issue with a NuGet Console. PowerShell is working fine.
Weiwei Cai on Mon, 12 Dec 2016 07:23:28
Does the Package Manager Console window work fine before?
If it working fine before, please check whether you have installed any updates for your Windows. You could check the installed Updates from Control Panel -> Programs and Features -> View Installed Updates.
If it doesn't work after installing Visual Studio 2015, please use http://aka.ms/vscollect to gather the VS and .Net Frameowrk installation logs. After using it, you will find vslogs.cab from %temp% folder. Please upload the file to Onedrive and share the link here.
In addition, please check your Windows version. I'm using Windows 10 version 1607 (OS Build 14393.447). And the Package Manager Console also working fine on Windows 10 version 10.0 (Build 10240). If any difference, please feel free to let me know.
AndyVGa on Mon, 12 Dec 2016 18:49:10
At Summer I had Windows 7 and everything working fine.
Approximately, in September I switched to Windows 10. Approximately at the end of September.
Currently I have Windows 10 Home, Version 1607, OS Build 14393.479 .
I have been working with an architecture and didn't use Visual Studio 2015 a lot. In particular, I didn't use ASP.NET . Recently I started to create ASP.NET MVC web site and found that issue.
As I explained earlier, I have reinstalled Visual Studio 2015 this weekend and nothing changed. I still have the same issue.
Please, find my logs:
Weiwei Cai on Tue, 13 Dec 2016 05:37:54
After analysis your Visual Studio installation log, I don't find any errors about NuGet Packages Manager for Visual Studio and your Visual Studio is installed correctly. So the problem is not related to Visual Studio installation.
Do you have tried open Manage NuGet Packages UI from PROJECT -> Manage NuGet Packages?
If the Manager UI could be opened correctly, the NuGet Packages Manager should be fine. The issue should related to the PowerShell. Otherwise, the issue is caused by the NuGet Packages Manager.
AndyVGa on Tue, 13 Dec 2016 05:48:53
I can open a PowerShell console. I can open NuGet manager from a project.
However, when I tried to load jQuery, for example, I have the same message as when trying to open Package Management Console.
The message is about that PowerShell couldn't be initialized. I have posted a picture before.
Weiwei Cai on Wed, 14 Dec 2016 02:41:32
According to all above troubleshooting, this issue should be more related to the PowerShell.
Please check your PowerShell version, does it 32 bit or 64 bit? Please make sure your PowerShell version is the same with Visual Studio. The Visual Studio should be 32 bit.
In addition, please run your Visual Studio as administrator to check whether this issue caused by the permissions.
AndyVGa on Wed, 14 Dec 2016 03:07:17
I always run a Visual Studio as an Administrator because I use unit tests.
I am attaching results of checking versions.
Unfortunately for now I don't know what else I can check.
AndyVGa on Wed, 14 Dec 2016 05:09:18
Hi Weiwei !
After all it is working!
I removed a PowerShell package from Visual Studio and started to reinstall NuGet from the version 3.3 .
It was working and proposed to make an update. I did.
Now it is working fine!
Unfortunately I have no ideas what it was...
Thank you very much for your help !!!
AndyVGa on Wed, 14 Dec 2016 05:29:11
I found the cause. It was a PowerShell manager for Visual Studio. It makes some changes and overwrites NuGet settings. After I completely deleted it and %AppData%\Microsoft\VisualStudio it works stable for me!
cdev1100 on Sat, 02 Jun 2018 01:37:45
So if you discovered the cause, what particular file did you delete? Your answer isn't clear to anyone else that might be having this problem.
Brian Bischof on Wed, 01 May 2019 17:03:00
I came across the answer in StackOverflow. I had to update the devenv.exe.config file with new settings and the got it working. See the question and scroll down a bit: (you don't need to delete any folders like it recommends)