Skip to content
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

[Breaking change]: .NET 7.0.2xx SDK Will No Longer Give Automatic RuntimeIdentifier Under Certain Circumstances Outside of Publish, including Restore #33051

Closed
2 of 3 tasks
nagilson opened this issue Dec 15, 2022 · 0 comments · Fixed by #33517
Assignees
Labels
binary incompatible Existing binaries may encounter a breaking change in behavior. breaking-change Indicates a .NET Core breaking change 📌 seQUESTered Identifies that an issue has been imported into Quest. source incompatible Source code may encounter a breaking change in behavior when targeting the new version.

Comments

@nagilson
Copy link
Member

nagilson commented Dec 15, 2022

Description

This is because of this PR: dotnet/sdk#29031
As noted in #32816 : In the 7.0 SDK, we added a change that gives an automatic RuntimeIdentifier for properties that require a RuntimeIdentifier. These properties are as follows:

  • SelfContained
  • PublishAot
  • PublishReadyToRun
  • PublishSingleFile
  • PublishSelfContained ( In 7.0.200+)

However, some of these properties are Publish only properties. Namely, - PublishAot, PublishReadyToRun, PublishSingleFile, and PublishSelfContained. Yet we still added the implicit RuntimeIdentifier even when doing any dotnet operation, such as dotnet build, if these properties were in the project file or specified in the dotnet invocation.

Now, we have limited the automatic RID for these properties to only appear during publish, and only when doing a dotnet publish from the CLI, not from VS, and not from MSBuild, as those are separate mechanisms, and VS should give the RID in its own codebase.

This means there was a short period of time in 7.0 (RC1 to 7.0.2xx) where doing a build with these properties would get a RID, now they don't get a RID. It also affects --no-restore, as you got an implicit RID when doing a restore, but now you need to give the RID like dotnet restore -r RID if you want dotnet publish --no-restore with one of these properties for it to work.

image

Version

.NET 7

Previous behavior

Previous behavior is if you specified the above properties you would get the RID, now you only get it while doing dotnet publish. This also means any restore that was added without a RID in 7.0, that was used to restore for a publish --no-restore using one of the 4 above properties will now require a RID.

New behavior

The RID is only automatically added in the event of doing a dotnet publish.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
  • Behavioral change: Existing binaries may behave differently at run time.

Reason for change

The RID change was a breaking change and it doesnt make sense for a publish property to affect dotnet build and friends.

Recommended action

For something like restore, publish --no-restore, you need to add the rid via dotnet restore -r RID . It would be better to then also be explicit when publishing so the publish has the same RID (dotnet publish -r RID), or just remove --no-restore from the publish.

For everything else, no action is needed, unless you want to keep the RID, in which case you can add it to the project file like <RuntimeIdentifier>Foo</RuntimeIdentifier>

Feature area

SDK

Affected APIs

No response


Associated WorkItem - 59319

@nagilson nagilson added doc-idea breaking-change Indicates a .NET Core breaking change labels Dec 15, 2022
@dotnet-bot dotnet-bot added ⌚ Not Triaged Not triaged binary incompatible Existing binaries may encounter a breaking change in behavior. source incompatible Source code may encounter a breaking change in behavior when targeting the new version. labels Dec 15, 2022
@gewarren gewarren removed the ⌚ Not Triaged Not triaged label Dec 15, 2022
@gewarren gewarren added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label Jan 10, 2023
@ghost ghost added the in-pr This issue will be closed (fixed) by an active pull request. label Jan 13, 2023
@github-actions github-actions bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels Jan 13, 2023
@gewarren gewarren moved this from 🔖 Ready to 🏗 In progress in dotnet/docs January 2023 sprint Jan 13, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in dotnet/docs January 2023 sprint Jan 13, 2023
@ghost ghost removed the in-pr This issue will be closed (fixed) by an active pull request. label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary incompatible Existing binaries may encounter a breaking change in behavior. breaking-change Indicates a .NET Core breaking change 📌 seQUESTered Identifies that an issue has been imported into Quest. source incompatible Source code may encounter a breaking change in behavior when targeting the new version.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants