diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 index a4379c0b5..33530d33c 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -226,15 +226,14 @@ function Get-DotnetRuntimes { function Get-DotnetFrameworkTools { $path = "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\*\*\NETFX*" - $frameworkVersions = @() - Get-ChildItem -Path $path -Directory | ForEach-Object { - $frameworkVersions += ($_.Name -Split(" "))[1] - $frameworkPath = $_.Fullname -Replace " \d+\.\d+(\.\d+)?", " " - } + Get-ChildItem -Path $path -Directory | Group-Object { + $_.Fullname -Replace " \d+\.\d+(\.\d+)?", " " + } | ForEach-Object { [PSCustomObject]@{ - Versions = $frameworkVersions -Join " " - Path = $frameworkPath + Versions = $_.Group.Name | ForEach-Object { $_.Split(" ")[1] } + Path = $_.Name } + } } function Get-PowerShellAzureModules { diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 3af3f431e..cf34a2fa4 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -267,12 +267,15 @@ Get-DotnetRuntimes | Foreach-Object { } $markdown += New-MDHeader ".NET Framework" -Level 3 -$frameworks = Get-DotnetFrameworkTools $markdown += "``Type: Developer Pack``" $markdown += New-MDNewLine -$markdown += "``Location $($frameworks.Path)``" -$markdown += New-MDNewLine -$markdown += New-MDList -Lines $frameworks.Versions -Style Unordered +Get-DotnetFrameworkTools | Foreach-Object { + $path = $_.Path + $versions = $_.Versions + $markdown += "``Location: $path``" + $markdown += New-MDNewLine + $markdown += New-MDList -Lines $versions -Style Unordered +} $markdown += New-MDHeader ".NET tools" -Level 3 $tools = Get-DotnetTools diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index 4476a43b3..515df57a2 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -103,8 +103,7 @@ Describe "GoogleCloudSDK" -Skip:(Test-IsWin22) { Describe "NET48" { It "NET48" { - $netPath = (Get-DotnetFrameworkTools).Path.Split("<")[0] - ${netPath} + "4.8 Tools" | Should -Exist + (Get-DotnetFrameworkTools).Versions | Should -Contain "4.8" } }