-
Notifications
You must be signed in to change notification settings - Fork 6k
Self-contained deployment runtime roll forward #5670
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks great @JRAlexander
I had one suggestion to add, and then
|
||
Running `restore` as part of the `publish` operation may be undesirable for your scenario. To avoid `restore` during `publish` while creating self-contained applications, do the following: | ||
|
||
* Set the `RuntimeIdentifiers` property to a semicolon-separated list of all the [RIDs](../rid-catalog.md) to be published |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this go in the csproj / vbproj file? It should be specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
|
||
.NET Core [self-contained application deployments](index.md) include both the .NET Core libraries and the .NET Core runtime. Starting in .NET Core SDK 2.1.300 (.NET Core 2.1), a self-contained application deployment [now publishes the highest patch runtime on your machine](https://github.com/dotnet/designs/pull/36). By default,[`dotnet publish`](../tools/dotnet-publish.md) for a self-contained deployment selects the latest version installed as part of the SDK on the publishing machine. This enables your deployed application to run with security fixes (and other fixes) available during `publish`. The application must be re-published to obtain a new patch. Self-contained applications are created by specifying `--self-contained` on `dotnet publish` command or by specifying the RuntimeIdentifier in the project file or on the command line. | ||
|
||
[`restore`](../tools/dotnet-restore.md), [`build`](../tools/dotnet-build.md) and [`publish`](../tools/dotnet-publish.md) are `dotnet` commands that can run separately. The runtime choice is part of the `restore` operation, not `publish` or `build`. If you call `publish`, the latest patch version will be chosen. If you call `publish` with the `--no-restore` argument, then you may not get the desired patch version because a prior `restore` may not have been executed with the new self-contained application publishing policy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may not get the desired patch version
If you would get the wrong patch version in this case, you will actually get a build error. So I'd add the following sentence:
In this case, a build error will be generated with text similar to the following:
The project was restored using Microsoft.NETCore.App version 2.0.0, but with current settings, version 2.0.6 would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore.
Once this doc is published I think it would be a good idea to add an aka.ms link to this doc page in the error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
* Set the `RuntimeIdentifiers` property to a semicolon-separated list of all the [RIDs](../rid-catalog.md) to be published | ||
* Set the `TargetLatestRuntimePatch` property to `true` | ||
|
||
To create both self-contained applications and [framework-dependent applications](index.md) with the same project file, use `dotnet publish --no-restore` and choose one of the following: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reword this to make this clear that this is only necessary if you don't want to restore when publishing. If you don't need to use the --no-restore
flag, then you don't need to do anything special in order to create both an FDD and SCD from the same project file. You can just do, for example:
dotnet publish
dotnet publish -r win10-x64
Perhaps a good way to reword this would be:
If you want to create both self-contained applications and framework-dependent applications with the same project file, and you want to use the
--no-restore
argument withdotnet publish
, then choose one of the following:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
--- | ||
# Self-contained deployment runtime roll forward | ||
|
||
.NET Core [self-contained application deployments](index.md) include both the .NET Core libraries and the .NET Core runtime. Starting in .NET Core SDK 2.1.300 (.NET Core 2.1), a self-contained application deployment [now publishes the highest patch runtime on your machine](https://github.com/dotnet/designs/pull/36). By default,[`dotnet publish`](../tools/dotnet-publish.md) for a self-contained deployment selects the latest version installed as part of the SDK on the publishing machine. This enables your deployed application to run with security fixes (and other fixes) available during `publish`. The application must be re-published to obtain a new patch. Self-contained applications are created by specifying `--self-contained` on `dotnet publish` command or by specifying the RuntimeIdentifier in the project file or on the command line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally you wouldn't explicitly specify the --self-contained
argument. You need to specify a RID with -r
anyway, and if you do, then --self-contained
will default to true. So I'd probably replace --self-contained
with -r <RID>
or similar in this sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Agreed
Closing and reopening |
Self-contained deployment runtime roll forward
Fixes #4540
Internal Review URL