Legacy-style project referencing duplicate multi-targetting projects don't set the TF on the reference correctly.
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
### Issue Description
In certain scenarios, we get a `error MSB4057: The target "GetTargetPath" does not exist in the project.` due to the TF not properly being set on a project reference.
### Steps to Reproduce
Proj1\Proj1.csproj:
```xml
v4.7.2
Library
```
(Note the project references are differently-cased)
Proj2\Proj2.csproj:
```xml
netstandard2.0;net472
```
Commands:
```
msbuild /t:Restore Proj1\Proj1.csproj
msbuild Proj1\Proj1.csproj /p:BuildProjectReferences=false /bl
```
### Expected Behavior
The build succeeds.
### Actual Behavior
The build fails with `proj2\proj2.csproj : error MSB4057: The target "GetTargetPath" does not exist in the project.`
### Analysis
The specific piece of logic which is failing to run is:
```xml
TargetFramework=%(AnnotatedProjects.NearestTargetFramework)
```
That translates the `NearestTargetFramework` computed by `GetReferenceNearestTargetFrameworkTask` to `SetTargetFramework`, which is used when executing on project references.
Oddly, I couldn't seem to get this to repro if:
* Proj1 is an SDK-style project
* The duplicated `ProjectReference` did not differ in case (I guess there's some case-sensitive deduplication somewhere?)
Also note that the `/p:BuildProjectReferences=false` just helps show off the error more easily. Without it, the TF is still not properly set so the project refernce is "fully" built instead of building only 1 TF. Furthermore, I believe in this case the referenced project's assembly isn't returned so isn't actually given to the referencing project's compiler, an obvious downstream problem.
### Versions & Configurations
16.9.0-preview-21076-21+8ed151254 (but it repros for earlier versions too.)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.