Implement mode option for dotnet publish.#9460
Implement mode option for dotnet publish.#9460wli3 merged 3 commits intodotnet:release/2.1.4xxfrom peterhuene:fx-dep-apphost
mode option for dotnet publish.#9460Conversation
This commit implements a `mode` option that can control how an application is published with the `dotnet publish` command. There are three supported modes: * self-contained: publishes a self-contained application (same as --self-contained). * fx-dependent: publishes a framework-dependent application (with an application host when a runtime is specified). * fx-dependent-no-exe: publishes a framework-dependent application without an application host. The default when publishing without a runtime specified is `fx-dependent-no-exe`. The default when publishing with a runtime specified is `self-contained`. `fx-dependent` requires netcoreapp2.1 or later when a runtime is specified. The `--self-contained` option is still supported, but is now hidden so that users will be encouraged to move to the `--mode` option. Fixes #6237.
dsplaisted
left a comment
There was a problem hiding this comment.
Should the --mode switch only be a parameter that the CLI understands, or should we have a PublishMode MSBuild property and have the inference of the other properties be based on that in the SDK?
| <data name="ModeOptionDescription" xml:space="preserve"> | ||
| <value>The mode to use when publishing the application. | ||
| The 'self-contained' mode publishes the application with the .NET Core runtime. | ||
| The 'fx-dependent' mode publishes the application as framework-dependent with an executable if a target runtime is specified. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| <value>The configuration to publish for. The default for most projects is 'Debug'.</value> | ||
| </data> | ||
| <data name="PublishModeAndSelfContainedOptionsConflict" xml:space="preserve"> | ||
| <value>The '--mode' and '--self-contained' options conflict. Specify only one of the options.</value> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| { | ||
| var testInstance = TestAssets.Get(testAppName) | ||
| .CreateInstance($"PublishesSelfContained{selfContained}") | ||
| .CreateInstance($"PublishApp_{rid ?? "none"}_{mode ?? "none"}") |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Tests are failing because the framework-dependent apphost needs to find the runtime-under-test, probably with spawning with I'll make the fix. |
Amending string resources based on suggestions. Fixing tests that need DOTNET_ROOT set. Adding args to the asset instance name for `PublishApp`.
Ensure the correct DOTNET_ROOT variable is set for the apphost being run.
|
@KathleenDollard Here's the PR for what we settled on from the SDK PR for this feature. Would you mind reviewing the UX here and see if there's anything that can be improved? Thanks! |
|
About the CLI logic vs MSBuild logic: |
|
@dsplaisted thanks! looks this is all green, should we merge it? @livarcocc |
|
Talked to @peterhuene and we will wait for @nguerrera to be back and take a look before merging. |
|
Talked to @livarcocc later. This is blocking info bar change. So, let's merge it first and follow up later. |
|
Added https://github.com/dotnet/cli/issues/9503 to keep track |
This PR implements a
modeoption that can control how an application ispublished with the
dotnet publishcommand.There are three supported modes:
self-contained: publishes a self-contained application (same as--self-contained).
fx-dependent: publishes a framework-dependent application (with anapplication host when a runtime is specified).
fx-dependent-no-exe: publishes a framework-dependent application without anapplication host.
The default when publishing without a runtime specified is
fx-dependent-no-exe.The default when publishing with a runtime specified is
self-contained.fx-dependentrequires netcoreapp2.1 or later when a runtime is specified.The
--self-containedoption is still supported, but is now hidden so thatusers will be encouraged to move to the
--modeoption.Fixes #6237.