【发布时间】:2020-07-04 08:50:09
【问题描述】:
我有一个深度嵌套的存储库,其中包含许多 Visual Studio 项目。我需要找到所有具有 TargetFramework 3.5 和 Output Type 'console application' 的项目。
我发现控制台应用程序的 csproj 文件中有这个:
<OutputType>Exe</OutputType>
带有窗口的应用程序有这个:
<OutputType>WinExe</OutputType>
这让我可以找到所有扩展名为 csproj 的文件,这些文件可以编译为控制台应用程序。
$csproj_ConsoleExes = gci -Recurse *.csproj | select-string "<OutputType>Exe</OutputType>"
接下来我需要做什么:我只需要过滤那些使用 target-framework 3.5 的项目。但由于 $csproj_ConsoleExes 包含搜索结果,我不知道如何再次应用 select-string。 select-string 仅适用于 FileInfo 类型的输入对象。
感谢任何帮助。
【问题讨论】:
标签: visual-studio powershell select-string