[英]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.