.NET build started failing on latest Windows orb/executor version

Our .NET build has started to fail using the windows orb/executor.
The executor is just set to default and used the latest version.

Nothing has changed code wise on our end.

The msbuild command fails with errors suggesting it cannot find the .NET libraries. e.g.

  • The type or namespace name ‘System’ could not be found
  • Predefined type ‘System.String’ is not defined or imported
    Predefined type ‘System.Object’ is not defined or imported

The only difference I can see in the logs in the old executor version we were using (image: “windows-server-2019-vs2019:2023.04.1”) the $env:HOME pointed to *C:\Users\circleci* where as in the latest version (image: “windows-server-2019-vs2019:2023.08.1”) it points to *C:\Users\circleci.PACKER-64C83029*

we are using the $env:HOME variable in our nuget restore and msbuild commands:

MSBuild.exe $env:HOME\project\api\foobar.sln

As a work around i’ve pinned the executor version to the one which does work for us: 2023.04.1 but this is not an ideal long term solution.