-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update handling of SelfContained and RuntimeIdentifier properties when specified on the command line #21986
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
Merged
dsplaisted
merged 12 commits into
dotnet:release/7.0.1xx-rc1
from
dsplaisted:selfcontained-flow
Aug 22, 2022
Merged
Update handling of SelfContained and RuntimeIdentifier properties when specified on the command line #21986
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5c8503a
Improve handling of RuntimeIdentifier and SelfContained across projec…
dsplaisted 5f4ba10
Add test for SelfContained flowing across project reference
dsplaisted 63ae00b
Move AcceptsRuntimeIdentifier logic and exclude test projects
dsplaisted bf9b7a3
Add breaking change information
dsplaisted 45f8979
Detect whether SelfContained is a global property inside task
dsplaisted 117a1c9
Handle consuming AcceptsRuntimeIdentifier metadata from multi-targete…
dsplaisted 26df179
Use IsRidAgnostic instead of AcceptsRuntimeIdentifier
dsplaisted 579ad7f
Handle more cases of global property flow
dsplaisted 4468b0b
Add tests for global property flow across project references
dsplaisted 8a303dd
Code review feedback
dsplaisted 27fe291
Require updated MSBuild for global property flow tests
dsplaisted 4d634e9
Fix tests
dsplaisted File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
documentation/general/SelfContainedBreakingChangeNotification.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# [Breaking change]: Handling of command-line RuntimeIdentifier and SelfContained properties across project references | ||
|
||
## Description | ||
|
||
The `RuntimeIdentifier` and `SelfContained` properties can be specified on the command line to commands such as `dotnet build` and `dotnet publish`. | ||
They can be specified either via parameters such as `-r` or `--self-contained`, or via the generic `-p:Key=Value` parameter, such as `-p:SelfContained=true`. | ||
|
||
If these properties are specified on the command line, we've updated how they are applied (or not applied) to projects referenced by the initial project that is being built. | ||
|
||
## Version | ||
|
||
??? | ||
|
||
## Previous behavior | ||
|
||
If `SelfContained` was specified on the command line, it would always flow to referenced projects. | ||
|
||
`RuntimeIdentifier` would flow to referenced projects where either the `RuntimeIdentifier` or `RuntimeIdentifiers` properties were non-empty. | ||
|
||
## New Behavior | ||
|
||
Both `SelfContained` and `RuntimeIdentifier` will flow to a referenced project if any of the following are true for the referenced project: | ||
|
||
- The `IsRidAgnostic` property is set to `false` | ||
- The `OutputType` is `Exe` or `WinExe` | ||
- Either the `RuntimeIdentifer` or `RuntimeIdentifiers` property is non-empty | ||
|
||
## Type of breaking change | ||
|
||
Source incompatible | ||
|
||
## Reason for change | ||
|
||
As of .NET SDK 6.0.100, we recommend specifying the value for self-contained on the command line if you specify the RuntimeIdentifier. | ||
(This is because in the future we are considering [changing the logic](https://github.com/dotnet/designs/blob/main/accepted/2021/architecture-targeting.md) | ||
so that specifying the RuntimeIdentifier on the command line doesn't automatically set the app to self-contained.) We also added a warning message | ||
to guide you to do so. | ||
|
||
However, if you followed the warning and switched to a command specifying both the RuntimeIdentifier and the value for self-contained (for example | ||
`dotnet build -r win-x64 --self-contained`), the command could fail if you referenced an Exe project, because the `RuntimeIdentifier` you specified | ||
would not apply to the referenced project, but the `SelfContained` value would, and it's an error for an Exe project to have `SelfContained` set to | ||
true without having a `RuntimeIdentifier` set. | ||
|
||
## Recommended action | ||
|
||
If you were relying on the `SelfContained` property to apply to all projects when it was specified on the command line, then you can get similar behavior | ||
by setting `IsRidAgnostic` to false either in a file ([such as Directory.Build.props](https://docs.microsoft.com/visualstudio/msbuild/customize-your-build#directorybuildprops-and-directorybuildtargets)), | ||
or as a command-line parameter such as `-p:IsRidAgnostic=false`. | ||
|
||
## Open Questions | ||
|
||
TODO: How does this apply to solutions? Could a solution build set IsRidAgnostic to false for all projects, and would that fix other issues we have when specifying the RuntimeIdentifier for a solution build? | ||
TODO: What happens if there's an Exe1 -> Library -> Exe2 reference, especially if there's also a direct reference from Exe1 -> Exe2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.