Skip to content

Publish* properties should affect build -- making those apps RID-specific #34309

Open
@richlander

Description

@richlander

We've adopted the philosophy that we should apply user intent as early as possible in the development process so that developers have a chance to address all knowable problems while they are actively coding, avoiding preventable problems later in the process, and specifically in prod deployment. Crashes that could have been resolved (with more information) during active development are really unforgivable.

We call this philosophy "shift left". It's called that since we think of "left" as early in the development process and "right" as late, just like the process of reading a book (in a left to right language, like English).

We do this for analyzers, enabling various analyzers to run with build, based on the presence of Publish* properties. Example : https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=net7#aot-compatibility-analyzers

With that thinking, we should ensure that restore, build, and test do their best to provide high-fidelity results based on the intent described by Publish* properties.

The properties in scope:

  • PublishAot
  • PublishReadyToRun
  • PublishSelfContained
  • PublishSingleFile
  • PublishTrimmed

These properties all require/enforce a RID-specific. When any of those properties are present, the app should be RID-specific (including for restore).

It isn't clear that there is another change to infer, beyond making apps RID-specific. If there is, we should discuss it.

I'm proposing we make this change for 8.0.200. It's a breaking change, but arguable resolving a correctness issue. This would be a first step to making all apps RID-specific by default in .NET 9. I'm not entirely sure what the gesture would be to undo this change in behavior (if you didn't want it). We'd have to invent one. I think we had some ideas on that previously.

This change would also make these app types work better with Docker since various packs would be downloaded sooner (shifting those left as well).

Related: #34198

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions