简体   繁体   English

如何确定在Powershell的Visual Studio程序包管理器控制台中选择的默认项目?

[英]How do I determine the default project selected in the Visual Studio Package Manager Console in Powershell?

I am writing some Powershell scripts that are going to be in a Nuget package, which I will then run from the Package Manager Console. 我正在编写一些将在Nuget程序包中的Powershell脚本,然后将其从程序包管理器控制台中运行。 These scripts will run all the tests within the project that is selected in the "Default Project" drop down, in the Package Manager Console. 这些脚本将在程序包管理器控制台的“默认项目”下拉列表中选择的项目中运行所有测试。 My question is, how do I determine (in Powershell) which project is currently selected in the Package Manager Console? 我的问题是,如何确定(在Powershell中)程序包管理器控制台中当前选择的项目?

程序包管理器控制台屏幕截图

There are a number of useful commands available to you in the Package Manger Console, one of which is: 软件包管理器控制台中提供了许多有用的命令,其中之一是:

Get-Project which on its own will give you the name of the Default project in the Package Manager Console. Get-Project ,它本身会为您提供Package Manager控制台中Default项目的名称。 However: 然而:

Get-Project -All Produces a list of all the projects in the currently loaded solution. Get-Project -All生成当前加载的解决方案中所有项目的列表。

http://www.edcourtenay.co.uk/musings-of-an-idiot/list-referenced-nuget-packages-from-the-package-manager-console http://www.edcourtenay.co.uk/musings-of-an-idiot/list-referenced-nuget-packages-from-the-package-manager-console

You can determine the default project in Package Manager Console by using $proj . 您可以使用$proj在Package Manager控制台中确定默认项目。 You can verify the name of the project by typing write-host $proj.Name in the Package Manager Console and hitting Enter. 您可以通过在Package Manager控制台中键入write-host $proj.Name并单击Enter来验证项目的名称。 This will display the default project name in the Package Manager Console. 这将在Package Manager控制台中显示默认项目名称。 Hope this helps! 希望这可以帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Powershell包含在Visual Studio中的程序包管理器控制台中的项目中 - Powershell Include In Project From Package Manager Console In Visual Studio 如何在 Visual Studio 外使用包管理器控制台 powershell - How to use Package Manager Console powershell outside visual studio 如何在 Visual Studio 中配置包管理器控制台使用的 powershell 版本? - how to configure the powershell version used by the package manager console in visual studio? 在扩展中以编程方式访问visual studio的powershell控制台(包管理器控制台) - Access the powershell console (package manager console) of visual studio programmatically in an extension 如何在VS NuGet Package Manager控制台中永久设置新的Default项目? - How do I permanently set a new Default project in the VS NuGet Package Manager console? NuGet 包管理器 - 未找到项目“默认”。 - 视觉工作室 2017 - NuGet Package Manager - Project 'Default' is not found. - Visual Studio 2017 当我打开包管理器控制台时,Visual Studio 2015挂起 - Visual Studio 2015 hangs when I open the Package Manager Console 如何在Visual Studio中更改程序包管理器控制台的字体大小 - How to change Font Size of Package Manager Console in Visual Studio 如何在Visual Studio 2013中自动化Package Manager控制台 - How to automate Package Manager Console in Visual Studio 2013 Visual Studio 包管理器控制台的键盘快捷键? - Keyboard Shortcut for the Visual Studio Package Manager Console?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM