Skip to content

Failure in project reference target framework negotiation when ProjectReference items are duplicated #2688

Description

@dsplaisted

Build A.csproj in the below example.

EXPECTED: Build succeeds
ACTUAL:

C:\git\vstest\tools\dotnet\sdk\2.2.0-preview1-007460\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): Assets file 'C:\git\vstest\src\Microsoft.TestPlatform.CrossPlatEngine\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v1.0'. Ensure that restore has run and that you have included 'netcoreapp1.0' in the TargetFrameworks for your project. [C:\git\vstest\src\Microsoft.TestPlatform.CrossPlatEngine\Microsoft.TestPlatform.CrossPlatEngine.csproj]

The duplicated ProjectReference appears to be interfering with the logic in _GetProjectReferenceTargetFrameworkProperties which is supposed to set SetTargetFramework on the AnnotatedProjects.

A.csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>net46;netcoreapp1.0;netstandard1.4</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\B\B.csproj" />
    <ProjectReference Include="..\B\B.csproj" />
  </ItemGroup>

</Project>

B.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>net46;netstandard1.4</TargetFrameworks>
  </PropertyGroup>

</Project>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions