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

Update self contained/ runtime command line options for build and publish #18837

Merged

Conversation

sfoslund
Copy link
Member

@sfoslund sfoslund commented Jul 9, 2021

Fixes 4th and 5th bullets of #18832

Description

This change adds --self-contained and --no-self-contained options to the dotnet build command to achieve parity with dotnet publish. It also adds a warning for .NET 6+ apps when --runtime is specified on the CLI without --self-contained or --no-self-contained.
These changes are all additive and do not impact the existing CLI. Note that this doesn't change functionality, as users can achieve the same result by specifying self contained as a MSBuild property on the command line. This change will make it more straight forward to achieve the same result.

Regression?

No

Risk

Low, this is a new feature and won't effect existing CLI.

Verification

[X] Manual (required)
[x] Automated

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@sfoslund
Copy link
Member Author

@dsplaisted can I get a quick review here?

src/Cli/dotnet/CommonOptions.cs Show resolved Hide resolved
src/Cli/dotnet/CommonOptions.cs Outdated Show resolved Hide resolved
Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look good.

Personally I don't think we should have a --no-self-contained option. I think we should instead just use --self-contained false. I'd like @KathleenDollard to weigh in on this, and am happy to defer to whatever she thinks is best here.

I also believe that we will now repeat this warning for each (transitively) referenced project. Is that OK, or should we try to make the warning just show up once?

@@ -815,4 +815,8 @@ To install these workloads, run the following command: {1}</value>
<value>NETSDK1177: Failed to sign apphost with error code {1}: {0}</value>
<comment>{StrBegin="NETSDK1177: "}</comment>
</data>
<data name="SelfContainedOptionShouldBeUsedWithRuntime" xml:space="preserve">
<value>NETSDK1178: The '--self-contained' or '--no-self-contained' option should be used with '-r|--runtime'.</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richlander @KathleenDollard To review the warning text here. Perhaps something like the following would be clearer:

When the target runtime is specified with '--runtime' or '-r', the deployment type should be specified with '--self-contained' or '--no-self-contained'.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richlander suggested this string in the previous PR reviews.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems a bit long, and I like to reduce wrapping where possible. Maybe:

Suggested change
<value>NETSDK1178: The '--self-contained' or '--no-self-contained' option should be used with '-r|--runtime'.</value>
<value>NETSDK1178: The '--self-contained' or '--no-self-contained' option should be used when '--runtime' is specified.</value>

Daniel, is there a reason you want to lead with the conditional?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KathleenDollard It sounded a bit better to me, but it could certainly be reversed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like shorter version better.

How about this one?

One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate to keep this going, but...

Either '--self-contained' or '--no-self-contained' is required when '--runtime' is used.

Aligning "One of" and "are" grammatically seems hard ;-)

@sfoslund
Copy link
Member Author

Personally I don't think we should have a --no-self-contained option

For what its worth, `--no-self-contained is already an option for publish, so this PR just adds it to build for parity.

Copy link

@KathleenDollard KathleenDollard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I had an old pending comment as well on this

I'd like Rich's call on the string in question. I can live with any of the options as I think they are all clear.

src/Cli/dotnet/CommonLocalizableStrings.resx Outdated Show resolved Hide resolved
src/Cli/dotnet/CommonLocalizableStrings.resx Outdated Show resolved Hide resolved
src/Cli/dotnet/CommonLocalizableStrings.resx Outdated Show resolved Hide resolved
@@ -815,4 +815,8 @@ To install these workloads, run the following command: {1}</value>
<value>NETSDK1177: Failed to sign apphost with error code {1}: {0}</value>
<comment>{StrBegin="NETSDK1177: "}</comment>
</data>
<data name="SelfContainedOptionShouldBeUsedWithRuntime" xml:space="preserve">
<value>NETSDK1178: The '--self-contained' or '--no-self-contained' option should be used with '-r|--runtime'.</value>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems a bit long, and I like to reduce wrapping where possible. Maybe:

Suggested change
<value>NETSDK1178: The '--self-contained' or '--no-self-contained' option should be used with '-r|--runtime'.</value>
<value>NETSDK1178: The '--self-contained' or '--no-self-contained' option should be used when '--runtime' is specified.</value>

Daniel, is there a reason you want to lead with the conditional?

@sfoslund sfoslund changed the base branch from main to release/6.0.1xx-preview7 July 20, 2021 22:54
@sfoslund
Copy link
Member Author

@richlander @dsplaisted @KathleenDollard I've updated based on your feedback, thanks! We're hoping to get this in for preview 7 so can I please get another review?

src/Cli/dotnet/CommonOptions.cs Outdated Show resolved Hide resolved
@sfoslund sfoslund enabled auto-merge July 22, 2021 20:35
@sfoslund sfoslund merged commit 3d70279 into dotnet:release/6.0.1xx-preview7 Jul 23, 2021
@sfoslund sfoslund deleted the SelfContainedCmdOptions branch September 20, 2021 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants