After discussing with my team and a little experimentation, this is the direction we are currently leaning for solution, but I am 100% open to other suggestions on how to determine this:
$workingFolder = 'C:\ProgramData\chocolatey\lib\'
Get-ChildItem -Directory -Path $workingFolder | % {
$path = $_.FullName
$children = Get-ChildItem -Path $path -Recurse -Filter 'lib\runtimes\win\lib\' -Directory -ErrorAction Ignore
if ($children.Count -gt 0 -and -not ($children.Name -contains 'net6.0')) {
$problemFolder = Join-Path -Path $path -ChildPath 'lib\runtimes\win\lib\'
return (Get-ChildItem -Path $problemFolder -Directory)
}
}
In this case, every folder that has the subpath lib\runtimes\win\lib
(netcore|6 apps) but that does not have a subpath under that for net6.0
should drop some entries like this:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 4/7/2022 3:29 PM netcoreapp2.0
d----- 4/7/2022 3:29 PM netcoreapp2.1
d----- 4/7/2022 3:29 PM netcoreapp3.0
d----- 4/7/2022 3:29 PM netstandard2.0
Which we can see do not have a net6.0 but clearly have older runtime releated folders. The parent folders that either have no lib\runtimes\win\lib
structure, or that do have the lib\runtimes\win\lib\net6.0
subfolder tree, will not return on the above result set. Which is the behavior I'm seeing.
The faulty assumption that I know I am making is that it is possible to have a net6.0 application that does not contain this runtimes folder, but I feel like the knowledge and desire necessary to evoke that situation is suspect, as most of my devs, while highly competent, have no desire to change these semantics and make life harder for themselves. Rogue actors may exist in the ecosystem, but I hope not. Third parties likewise may have a problem, but again, simplest path is where most folks live.
While I am quite open to other answers (begging for them), I think this is what we are going to run with for now for our team (for the purposes of others coming here also wanting a solution to this problem)