Skip to content

Referencing a shared framework does not flow across ProjectReference #2420

Closed

Description

The value for the MicrosoftNETPlatformLibrary property does not flow across project references. This typically means that test projects will run on a shared framework that is different from the app they are testing.

Example scenario:

src/WebApp.csproj

	<TargetFramework>netcoreapp2.1</TargetFramework>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />

test/WebAppTests.csproj

	<TargetFramework>netcoreapp2.1</TargetFramework>
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.1.1" />
	<ProjectReference Include="../src/WebApp.csproj" />
  • WebApp.runtimeconfig.json will contain "framework": { "name": "Microsoft.AspNetCore.App", "version": "2.1.1" }
  • WebAppTests.runtimeconfig.json contains "framework": { "name": "Microsoft.NETCore.App", "version": "2.1.0" }

The result is that WebAppTests will run ASP.NET Core binaries out of NuGet packages, but the WebApp will execute off a shared runtime. Because of patch and minor runtime rollforward, this can mean the tests are executing something very different than the app.

cc @dsplaisted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions