Skip to content

Latest Microsoft.AspNetCore.App 2.2 version is not used automatically #942

@omajid

Description

@omajid

This is a regression. It's #586 but for 2.2.

In other words, consumers of source-build wont get the 2.2.1 ASP.NET Core security release!

This was supposed to have been fixed by https://github.com/dotnet/source-build/blob/release/2.2/patches/cli/0001-Persist-ASP.NET-runtime-patch-targeting-default.patch, but it turns out it's not sufficient for 2.2.

In 2.2, the final dotnet/sdk/$VERSION/Microsoft.NETCoreSdk.BundledVersions.props file contains this line:

    <!-- If true, always target the latest ASP.NET Core runtime by default -->
    <TargetLatestAspNetCoreRuntimePatch Condition="'' == ''">true</TargetLatestAspNetCoreRuntimePatch>

The settings in this file are consumed by dotnet/sdk/2.2.102/Sdks/Microsoft.NET.Sdk.Web/Sdk/Sdk.DefaultItems.targets. And this targets file is not loaded out of the box: dotnet/sdk/2.2.102/Sdks/Microsoft.NET.Sdk.Web/Sdk/Sdk.targets says:

<Import Project="$(MSBuildThisFileDirectory)Sdk.DefaultItems.targets" Condition="'$(EnableWebSdkImplicitPackageVersions)' == 'true'"/>

EnableWebSdkImplicitPackageVersions is false, as set by dotnet/websdk#414.
So our custom overrides to TargetLatestAspNetCoreRuntimePatch are ineffective.

This was an intentional change done by dotnet/websdk#414. The TargetLatestRuntimePatch flag added by dotnet/sdk#2533 lets me get the old behaviour via dotnet restore -p:TargetLatestRuntimePatch=true:

  Installing Microsoft.NETCore.App 2.2.1.                        
  Installing Microsoft.NETCore.Targets 2.0.0.                        
  Installing Microsoft.AspNetCore.App 2.2.1. 

However, this also forces Microsoft.NETCore.App to 2.2.1, which is against the goals of the roll-forward design: dotnet/designs#36

We need to make TargetLatestRuntimePatch or a Microsoft.AspNetCore.App/All-specific variant the default for source-build to get secure builds.

cc @tmds @RheaAyase

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions