Skip to content

Cross targeted project with different targetframeworks fail to load MetadataReferences #23114

@jeromelaban

Description

@jeromelaban

Version Used:
VS15.4

Steps to Reproduce:

  1. Create an empty solution
  2. Create a project named A with <TargetFrameworks>net46;netstandard1.0</TargetFrameworks>
  3. Create project named B with <TargetFrameworks>net46;netstandard2.0</TargetFrameworks>
  4. Make the B project reference A
  5. With Roslyn workspace APIs do the following:
var props = new Dictionary<string, string>() { { "TargetFramework", "netstandard2.0" } };
var ws = MSBuildWorkspace.Create(props);
var project = await ws.OpenProjectAsync("B.csproj");

Expected Behavior:
The project.MetadataReferences member contains valid references.

Actual Behavior:
The project.MetadataReferences member is empty.

The loaded project B will be in a inconsistent state, as MSBuildWorkspace will try to load the A project using netstandard2.0, which it does not support.

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions