dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.68k stars 1.06k forks source link

SDK and runtime compatibility #41893

Closed handerss-spotfire closed 3 months ago

handerss-spotfire commented 3 months ago

I asked a similar question a couple of months after .NET 6.0 launched but did not get an answer to my final question (https://github.com/dotnet/sdk/issues/25220) if the issue was only due to a bug or not.

To recap: a bug in System.Windows.Forms 6.0.2 (https://github.com/dotnet/winforms/issues/6663) caused programs compiled with a 6.0.2 SDK to no longer be executable by 6.0.0 and 6.0.1 runtimes. A response in that issue stated:

Any apps built on 6.0.m will work on the latest 6.0.n (where n > m). However apps built on 6.0.2+ won't work on 6.0.0 or 6.0.1. https://github.com/dotnet/winforms/issues/6663#issuecomment-1039910644

At the time we interpreted this as a general statement, meaning once we target a version of .NET we have to always use the oldest available SDK of that version to ensure all .NET runtimes can run our executable. Now that we're switching to .NET 8 we have locked the SDK at 8.0.204 and won't receive any more SDK updates until next LTS.

Is this correct or can we use any version of the .NET 8 SDK and guarantee that the compiled artifact will be executable by a .NET 8.0.0 runtime?

marcpopMSFT commented 3 months ago

@handerss-spotfire From my memory, there was a specific issue in how Windows Desktop ref packs were versioned back with 6.0.2 that caused this issue. I don't remember all of the details but I will believe it was a one-time issue and not intentional going forward. For all versions of 7 and 8, they should require 7.0.0 and 8.0.0 as a minimum runtime so this issue should not occur again (unless we mess things up like we did with 6.0.2).

@RussKie may remember more details of that particular issue.

RussKie commented 3 months ago

There was a bug which led to version increases for Windows Forms ref assemblies, but since we never serviced Windows Desktop SDK until 6.0.2 we hadn't known there was a bug. We have corrected the versioning of our ref assemblies, and since then everything should be working as promised/expected - meaninig doesn't matter what SDK X.Y is used to build an app, it will run against X.0 runtime.

handerss-spotfire commented 2 months ago

Thanks for the clarifications!