如何以编程方式列出解决方案中的所有项目? [英] How do I programmatically list all projects in a solution?
本文介绍了如何以编程方式列出解决方案中的所有项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以编程方式列出解决方案中的所有项目?我将使用脚本、命令行或 API 调用.
How do I programmatically list all of the projects in a solution? I'll take a script, command-line, or API calls.
推荐答案
这是一个从 .sln 文件中检索项目详细信息的 PowerShell 脚本:
Here's a PowerShell script that retrieves project details from a .sln file:
Get-Content 'Foo.sln' |
Select-String 'Project(' |
ForEach-Object {
$projectParts = $_ -Split '[,=]' | ForEach-Object { $_.Trim('[ "{}]') };
New-Object PSObject -Property @{
Name = $projectParts[1];
File = $projectParts[2];
Guid = $projectParts[3]
}
}
这篇关于如何以编程方式列出解决方案中的所有项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文