[Breaking change]: .NET 7.0.2xx SDK Will No Longer Give Automatic RuntimeIdentifier
Under Certain Circumstances Outside of Publish
, including Restore
#33051
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.
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 aRuntimeIdentifier
. 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
, andPublishSelfContained
. Yet we still added the implicitRuntimeIdentifier
even when doing anydotnet operation
, such asdotnet 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 likedotnet restore -r RID
if you wantdotnet publish --no-restore
with one of these properties for it to work.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 apublish --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
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 viadotnet 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
The text was updated successfully, but these errors were encountered: