powershell.net-corevisual-studio-buildtools

Adding `dotnet-9.0-sdk` broke PowerShell script


After changing version of visualstudio2022buildtools from 117.8.3.0 to 117.13.1 and installing dotnet-9.0-sdk the following script started to error:

Add-Type -Path "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\Microsoft.Build.dll" [Microsoft.Build.Construction.SolutionFile]::Parse('C:/Test/Test.sln')

Exception calling "Parse" with "1" argument(s): "Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified." At C:\Test\run.ps1:2 char:1 + [Microsoft.Build.Construction.SolutionFile]::Parse('C:/Test/Test ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : FileNotFoundException

I tried to change 2022 in the script to 2019 and 2017 - the same error. Tried with downloaded Microsoft.Build.dll 17.11.4 and 17.13.9 - the same error. So, I assume that the culprit here is the additional version of the SDK.

enter image description here


Solution

  • I'm unclear on the exact problem, but you report that upgrading your PowerShell (Core) 7 version to 7.5.0 solved the problem.

    Observations about your symptom: