Nuget for PowerShell projects in Visual Studio

How can I install nuget packages for my PowerShell projects in Visual Studio 2015? I tried to do this with both the PowerShell module project and the PowerShell Script project. I installed PowerShell Tools for Visual Studio 2015.

When I open these projects, the default project in the package manager console is empty. Here is a screenshot of what I mean.

empty Default project:

When I try to install the nuget package, for example. Pester , I get the following error.

PM > Install-Package Pester Install-Package: Project 'Default'  . line: 1  char: 1 + Install-Package Pester + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo: ObjectNotFound: ( : String) [Install-Package ], ItemNotFoundExc eption + FullyQualifiedErrorId: NuGetProjectNotFound, NuGet.PackageManagement.PowerShellCmdlets.Inst allPackageCommand PM >

+4
source share
1 answer

, , . , , VS 2015 PowerShell NuGet .

:

  • https://chocolatey.org/ dev ( CI) = > pester : choco install pester .
  • pack.config nuget ( nuget ).
  • . nuget install pester ( - nuget)

: http://rostacik.net/2015/12/16/how-to-use-nuget-packages-even-with-powershell-projects-with-visual-studio-2015/

0

Source: https://habr.com/ru/post/1628875/


All Articles