Hello there,
We might need more info to conclude whether it is a bug or an environmental issue. You can use tolls like Procmon to analyze this.
Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity. You can get the tool from here https://docs.microsoft.com/en-us/sysinternals/downloads/procmon
If you're using MSBuild directly, not with Visual Studio, you should check the places where the WindowsTargetPlatformVersion property might be set. It's usually in the project file, but it could also be in an imported file or in a global settings file such as Directory.build.props.
MSBuild error MSB8036 https://learn.microsoft.com/en-us/visualstudio/msbuild/errors/msb8036?view=vs-2022
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer–