4

I have a powershell script which has nuget commands like:

Get-Project -All

Get-Package -ProjectName

When I run package manager console on visual studio like:

PM> .\download-packages-license.ps1

It worked but I cannot run powershell. I need a hlp.

Powershell error message:

download-packages-license.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/ fwlink/?LinkID=135170. At line:1 char:1 + .\download-packages-license.ps1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess

Aslı
  • 105
  • 1
  • 1
  • 9

1 Answers1

5

How to use Package Manager Console powershell outside visual studio

I am afraid you could not use Package Manager Console powershell outside visual studio. That because package manager console is providing is access to visual studio objects:

https://github.com/NuGet/Home/issues/1512

So, if you want use Package Manager Console powershell outside visual studio, we have to parse the .csproj file or .sln solution file with powershell manually, like:

How do I programmatically list all projects in a solution?

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135