簡體   English   中英

Nuget for Visual Studio中的PowerShell項目

[英]Nuget for PowerShell Projects in Visual Studio

如何在Visual Studio 2015中為PowerShell項目安裝nuget包? 我嘗試使用PowerShell模塊項目和PowerShell腳本項目。 我已經為Visual Studio 2015安裝了PowerShell工具。

當我打開這些項目時,程序包管理器控制台中的默認項目為空。 這是我的意思的屏幕截圖。

空默認項目:

當我嘗試安裝nuget包時,例如Pester ,我收到以下錯誤。

PM> Install-Package Pester安裝包:找不到項目“默認”。在行:1 char:1 + Install-Package Pester + ~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:ObjectNotFound :(默認值:字符串)[Install-Package] ,ItemNotFoundExc eption + FullyQualifiedErrorId:NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.Inst allPackageCommand PM>

我知道這個帖子可能已經過時而且相當陳舊但是我的舊文章提供了一些可能的解決方案可能對此有所幫助。 我測試了當前狀態,但仍然沒有支持VS 2015內的PowerShell項目和NuGet包。

目前的狀態是:

  1. 請使用https://chocolatey.org/並將其安裝在您的開發箱(和CI)=>全局安裝pester: choco install pester並根據需要進行更新。
  2. 使用舊的packages.config並手動更新版本號並運行nuget restore (nuget update將不再適用於此類解決方案)。
  3. 版本整個pester進入repo並直接調用它。 你可以使用nuget install pester (如果你在某個地方有路徑的nuget)

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM