Not built-in, and not sure if robust. But it works for me and is available at a right-click. Suggest improvements if you have.
Save this powershell script in a file like 'Get_TargetFrameworks.ps1':
param (
[string]$solutionFolder
)
$indentColumn = 30
Get-ChildItem $solutionFolder -Include *.csproj -Recurse -Force | ForEach-Object {
[xml]$projectXml = (Get-Content ($_))
$namespace=New-Object System.Xml.XmlNamespaceManager($projectXml.NameTable)
$namespace.AddNamespace("nsp", $projectXml.DocumentElement.NamespaceURI)
$dotnetVersionNode = $projectXml.SelectSingleNode("//nsp:TargetFrameworkVersion", $namespace)
if ($dotnetVersionNode -eq $null) {
$dotnetVersionNode = $projectXml.SelectSingleNode("//nsp:TargetFramework", $namespace)
}
$indent = $_.Name.Replace(".csproj", "") + " "
$spacesNeeded = [Math]::Max(0, $indentColumn - $indent.Length)
$spaces = ' ' * $spacesNeeded
$output = "{0}{1}{2}" -f $indent, $spaces, $dotnetVersionNode.InnerXml
Write-Host $output
}
Pause
Add to Explorer right-click menu:
Swap <File path> with actual, save as 'Get_TargetFrameworks.reg' file, and run to install in registry:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\GetTargetFrameworks]
@="Get Target Frameworks"
[HKEY_CLASSES_ROOT\Directory\Background\shell\GetTargetFrameworks\command]
@="PowerShell.exe -ExecutionPolicy Bypass -File \"<File path>""