-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
.NET 8: [breaking] dotnet build/publish produces RID-specific apps by default #23540
Comments
Zooming out a bit, there are three different use cases to consider (using partially made up syntax):
Today, the first is the default, the second is a straightforward option, and the last is effectively not supported/possible (even though I'm arguing that it is both a good option and the best default). There are two questions:
Since I published this proposal, there has been concern raised that it will break tooling. If tooling works best with portable, then it should opt the app into portable publishing as a default, and offer an opt-out if the developer knows better. Given my proposal, the most obvious options are:
|
Currently if you speficy RID, |
This feature has no effect on that. It only changes whether |
It's related. Now normal Though I just tried |
Sorry. I wrote so many specs. I got confused which one I was reply on. I will provide a better answer now. Thanks for your patience. First, the proposal is to make the dotnet build --use-current-runtime --self-contained false Note: We're not going to make this change in .NET 7 (per dotnet/core#7131). For most apps, there would be ZERO difference. Most apps don't have RID-specific dependencies. For apps that have RID-specific dependencies, the effective change is that they would be:
See this spec. It describes a first step on that journey that is very similar/related: #26031. On the error, that's another point of this journey. I asked the team to insert that warning to enable us to make a breaking change later. It's a way of saying that |
I'm against it. In a microservice environment with IoT (ARM64 in addition to AMD64) and multiple types of developer hardware (Windows PC, Linux PC, MacOS) it's important to be able to build portable apps so build step can be done once in CI/CD only, not redundant per target platform. In my opinion platform independent should be default, the argument "size" doesn't really count when it comes to containers. It would be more interesting to be able to have dotnet publish being able to publish "external dependencies only" and .NET applications able to use dependencies from a different directory (so we could build images with the dependencies pre-installed). Things like that. |
We won't be doing this. New proposal for something related, though not the breaking change: #29950 |
[breaking] dotnet build/publish produces RID-specific apps by default
Proposal:
dotnet build
(and friends) produce RID-specific apps by default. This change results in apps that are smaller, simpler, faster to startup, and more reliable.Proposal:
any
is the new RID for portable apps, since they will no longer be the default.Example:
This app, with a SkiaSharp dependency, is 31MB by default (with the existing behavior) and ~9MB with the proposed behavior. That's a significant benefit. If you have multiple RID-specific dependencies, then the benefit could be higher.
Related: #23539
Context
.NET Core 1.0 started with the concept of both portable and RID-specific apps. We thought of portable apps as being matched with framework-dependent deployment and RID-specific apps being matched with self-contained deployment. That made good sense at the time. The idea is that portable apps could run on any runtime you paired the app with, and self-contained apps could only run in the specific environment that they were published for. Also, self-contained apps were the only apps with executables. Framework dependent. It wasn't until .NET Core 3.0 that framework dependent apps got native executables by default. We now have a platform that has a diverse set of application offerings, which bias to portable or RID-specific apps being preferred. It's worth re-considering which of the two models should be the default.
Portable apps only make sense if the following characteristics are all true:
dotnet MyApp.dll
pattern.Client apps don't satisfy those characteristics:
Server apps are mixed:
There is also the scenario where a dependency may have a security issue (CVE) on one platform and not another. It would be nice if you didn't have to service a Linux binary on Windows (or vice versa) just to satisfy compliance rules.
In looking at the landscape, it becomes obvious that most scenarios benefit significantly from RID-specific deployment (either framework-dependent or self-contained) and that only niche scenarios benefit from portable apps. As a result, we should switch to RID-specific builds as the new SDK default.
Note: It turns out we already did this in very early .NET 7, but it wasn't quite complete:
--sc
#21405The text was updated successfully, but these errors were encountered: