Something changed on my system, and I’m not sure what. I have been able to create new projects left and right in VS2013 for a long, long time. Then, today, while creating a One ASP.NET project that included WebForms, MVC, and WebAPI (it’s for a demo app that I am creating), I got the following Package Installation Error:
Image: Package Installation Error Could not add all required packages to the project.
This is due to a security policy in place that restricts how packages get installed. For more information on the different execution policy settings, see the help topic at http://go.microsoft.com/fwlink/?LinkID=135170.
Damn the Torpedoes! Full Speed Ahead!
If you want to change the policy to prevent this error in Visual Studio, you can set the execution policy to unrestricted by following the steps outlined below. Note: You need to make sure you understand the security implications of making this change, as bad things can happen if you do this!
- Open up a PowerShell console as administrator
- Type the following command: Set-ExecutionPolicy Unrestricted
- You will be duly warned about changing the policy. If you have read and understand the implications of making this change, then enter a Y and press enter.
As noted in the documentation, this change does the following:
- Unsigned scripts can run. (This risks running malicious scripts.)
- Warns the user before running srcipts and configuration files that are downloaded from the Internet.
So, again, make sure you understand the implications of making this change. You are solely responsible for any potential side effects!