Skip to content

Don't omit Microsoft.NETCore.App from list of frameworks in runtimeconfig #17982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2021

Conversation

dsplaisted
Copy link
Member

@dsplaisted dsplaisted commented May 31, 2021

In .NET Core 3.0, we added the ability to have multiple shared frameworks, which are listed in the runtimeconfig.json file. However, due to issues in the host, we omitted the base Microsoft.NETCore.App framework from the list in the runtimeconfig if there were any other frameworks.

The bugs in the host have long since been fixed (as far as I know). However, omitting the Microsoft.NETCore.App entry from the frameworks was causing issues in dotnet/sdk, where we override the version of the base framework. Projects that used a higher-level framework such as Microsoft.AspNetCore.App were loading the wrong version of Microsoft.NETCore.App, as the version compiled against wasn't listed in the runtimeconfig.

PR where we hit this: #17948
Commit with workaround: 150c6fa

This PR currently changes the logic so that Microsoft.NETCore.App will by default always be listed in the runtimeconfig when targeting .NET 6 or higher. In any case the AlwaysIncludeCoreFrameworkInRuntimeConfig property can be used to override the default behavior.

I think the issues were fixed before .NET Core 3.0 released, so we might be able to always make the default to list all frameworks if the breaking change risk is low.

@ghost
Copy link

ghost commented May 31, 2021

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@dsplaisted dsplaisted requested review from vitek-karas and a team June 1, 2021 06:17
Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell the bug has been fixed in 3.0 release. So unless we officially support 2.* apps with the .NET 6 SDK it should be OK to always do this without a way to opt-out.

I think we should just change this.

@@ -40,7 +40,7 @@ public void Multiple_frameworks_are_written_to_runtimeconfig_when_there_are_mult
var testProject = new TestProject()
{
Name = "MultipleFrameworkReferenceTest",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test for lower TFM still having the Microsoft.NETCore.App?

@dsplaisted dsplaisted force-pushed the include-netcore-in-runtimeconfig branch from 6f084c9 to 6c4881d Compare June 2, 2021 14:50
@dsplaisted dsplaisted enabled auto-merge June 2, 2021 14:51
@dsplaisted dsplaisted merged commit bde62ca into dotnet:main Jun 2, 2021
dsplaisted added a commit to dsplaisted/sdk that referenced this pull request Jun 18, 2021
…icrosoft.NETCore.App shared framework"

This reverts commit 150c6fa.

Workaround is no longer needed with dotnet#17982
dsplaisted added a commit to dsplaisted/sdk that referenced this pull request Jul 6, 2021
…icrosoft.NETCore.App shared framework"

This reverts commit 150c6fa.

Workaround is no longer needed with dotnet#17982
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants