Skip to content

Produce reference assemblies for Microsoft.AspNetCore.App #3610

@natemcmaster

Description

@natemcmaster

In order to satisfy the requirements of making Microsoft.AspNetCore.App a ref-only package (#3608), we need to change our build system to produce reference assemblies for API in Microsoft.AspNetCore.App.

Requirements

  • Reference assemblies do not contain implementation.
  • API breaking changes to any assembly in Microsoft.AspNetCore.App are not allowed after 3.0.0
  • Reference assemblies must not change assembly version in patch updates. They remain constant at "Version=3.0.0.0" for the lifetime of netcoreapp3.0.
  • Assembly version bumps when the TFM changes. So when/if netcoreapp3.1 comes along, assemblies change to "Version=3.1.0.0"
  • Implementation binaries must satisfy the API surface of the reference assembly
  • When Microsoft.Extensions.* APIs are used in projects targeting .NET Framework, automatic binding redirect generation must continue to work correctly

Proposed solution

  1. Generate source for ref assemblies

We use build tools from https://github.com/dotnet/arcade to generate reference assemblies from implementation projects. This generated source lives in the repo next to the implementation. Most assemblies in the shared framework will have a folder layout like this:

.../Microsoft.AspNetCore.Mvc/
	ref/
		Microsoft.AspNetCore.Mvc.csproj
		Microsoft.AspNetCore.Mvc.cs       (generated by tools, should not be hand edited)
	src/
		Microsoft.AspNetCore.Mvc.csproj
		**/*.cs       (code for the implementation of Microsoft.AspNetCore.Mvc.dll)
	test/ (optional - unit tests)
		Microsoft.AspNetCore.Mvc.Tests.csproj
		**/*.cs       (test code)
  1. Implement tests to ensure implementation matches the ref API

Wire up the build to use tools from https://github.com/dotnet/arcade which assert that the implementation binaries are binary compatible with their reference assemblies. This is essential to making sure patches don't break API.

Open questions

  • How to structure NuGet packages and set assembly versions without introducing downgrade errors or producing incorrect binding redirects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DoneThis issue has been fixedarea-infrastructureIncludes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions