Changing project order in solution makes the build fail
https://github.com/Rubjerg/Graphviz.NetWrapper/pull/33 reproduces the issue.
This problems only occurs when executing MSBuild Rubjerg.Graphviz.sln from the commandline (Developer Command Prompt for VS 2019).
From within Visual Studio the build always succeeds.
MSBuild version is the newest: 16.8.3.61104
Project build order on master according to VS:
On PR:

Top lines of diff of build logs

Issue filed: https://github.com/dotnet/project-system/issues/6988
Issue has been moved: https://github.com/dotnet/msbuild/issues/6198
Related issue: https://github.com/dotnet/msbuild/issues/1054 With fix: https://github.com/dotnet/msbuild/pull/6622
See if https://github.com/dotnet/msbuild/issues/9709 is related
Hello, I've created a fix PR for the issue with some comments. Probably not necessary to merge, however since it isn't fix related to changing MSBuild code but rather to working with the .csproj files, this was the only place to put it to give it visibility.
My analysis of the solution and why I think it works is within the PR.