Microsoft.Build.Evaluation.Project doesnt work correctly when TargetFrameworks (extra s) property is defined
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
### Issue Description
We are targetting our projects with multiple TFMs as net48 and net8.0. For that reason we have TargetFrameworks defined in project files instead of TargetFramework. TargetFramework property is not defined at all. Such projects compile just fine (two different binaries are produced) and VS is loading and showing those projects correctly as well. However we have additional tools which are internally using Microsoft.Build.Evaluation.Project instances and accessing collections like Items. If projects are defined with TargetFramework (no extra s) property. Such collection contains all items like compilation items (source files), content items etc. However when exactly same project is defined with TargetFrameworks (extra s), such collection no longer contains any of the items (compile, content etc.). And this is causing failure of our in-house tooling. It seems that when TargetFrameworks is defined, project is no longer handled as SDK style projects and none of the imports and logic works anymore for such projects. Small repro solution attached together with images of Items collection for both cases.
[TFMIssue.zip](https://github.com/dotnet/msbuild/files/13810616/TFMIssue.zip)


### Steps to Reproduce
Define project with TargetFRameworks property defined and TargetFramewok missing completely. Create instance of Microsoft.Build.Evaluation.Project by loading such project. Items collection (and similar) will not contain any compile, content etc items.

### Expected Behavior
When TargetFRamewoks property is defined (TargetFRamework missing). Instance of Microsoft.Build.Evaluation.Project should still provide compilation, content etc items in Items (and similar) collections.

### Actual Behavior
When TargetFRamewoks property is defined (TargetFRamework missing). Instance of Microsoft.Build.Evaluation.Project doesnt provide information's about compile, content etc items associated with project definition.
### Analysis
_No response_
### Versions & Configurations
Visual Studio 2022 17.8.3
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.