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

Use SingleFileHost for self-contained single-file apps #11567

Closed
swaroop-sridhar opened this issue May 5, 2020 · 3 comments · Fixed by #11797
Closed

Use SingleFileHost for self-contained single-file apps #11567

swaroop-sridhar opened this issue May 5, 2020 · 3 comments · Fixed by #11797
Assignees
Milestone

Comments

@swaroop-sridhar
Copy link
Contributor

There are two main tasks that need to be done for self-contained single-file publish scenario:

Use singlefilehost

  • @VSadov's PR adds singlefilehost to the microsoft.netcore.app.host.* packages.
  • ResolveAppHosts will resolve singlefilehost to the same package as apphost, ijwhost, and comhost.
  • When publishing for self-contained single-file apps, the CreateAppHost task will be invoked with the singlefilehost path as its AppHostSourcePath. This will generate an app using singlefilehost.
  • This may not work very well for a sequence such below. However, I think fixing this case is not crucial, because the --no-build already has similar concerns for self-contained vs framework-dependent publish.
    dotnet build -r win-x64 
    dotnet publish --no-build -r win-x64 /p:PublishSingleFile=true.

Trim the native components of the runtime:

  • Certain files in microsoft.netcore.app.runtime.* package are no longer necessary to be published for single-file apps.
  • For example, hostfxr and hostpolicy are not necessary since they are statically linked with singlefilehost. Later coreclr, clrjit will also be linked with the singlefilehost, and they are also not necessary. Certain other files such as createdump are excluded from the publish as a matter of policy decision.
  • This exclusion is different from ExcludeFromSingleFile
    • In this case, the files, the excluded files are not published at all (neither in the bundle nor in the publish directory beside the single-file bundle).
    • Files marked ExcludeFromSingleFile are copied to publish directory alongside the single-file app.
  • The plan to realize this exclusion of runtime components is:
    • The RuntimeList.xml in microsoft.netcore.app.runtime.* package will contain special meta-data identifying that the file is not necessary for single-file scenario
      <File FileVersion="0.0.0.0" Path="runtimes/linux-x64/native/createdump" Type="Native" DropFromSingleFile="true"/>
    • The ResolveRuntimePackAssets task will transfer this annotation as (DropFromSingleFile) meta-data on the asset.
    • The Single-file publish targets will use this meta-data to drop these files, and not publish them in the single-file app.
@swaroop-sridhar swaroop-sridhar self-assigned this May 5, 2020
@swaroop-sridhar
Copy link
Contributor Author

swaroop-sridhar commented May 5, 2020

@wli3
Copy link

wli3 commented May 6, 2020

dotnet build -r win-x64 
dotnet publish --no-build -r win-x64 /p:PublishSingleFile=true.

Should work. The package should be restored by the first build

The plan looks good to me @dsplaisted what do you think?

@dsplaisted
Copy link
Member

Yes, looks good

swaroop-sridhar added a commit to swaroop-sridhar/sdk that referenced this issue May 28, 2020
When publishing self-contained single-file apps:
* Use `SingleFileHost` instead of `apphost`
* Trim the native components of the runtime published for the app.
* Implement options: IncludeNativeBinariesInSingeFile, IncludeAllContentInSingleFile

Fixes dotnet#11567.
swaroop-sridhar added a commit to swaroop-sridhar/sdk that referenced this issue May 28, 2020
When publishing self-contained single-file apps:
* Use `SingleFileHost` instead of `apphost`
* Trim the native components of the runtime published for the app.
* Implement options: IncludeNativeBinariesInSingeFile, IncludeAllContentInSingleFile

Fixes dotnet#11567.
swaroop-sridhar added a commit to swaroop-sridhar/sdk that referenced this issue May 29, 2020
When publishing self-contained single-file apps:
* Use `SingleFileHost` instead of `apphost`
* Trim the native components of the runtime published for the app.
* Implement options: IncludeNativeBinariesInSingeFile, IncludeAllContentInSingleFile

Fixes dotnet#11567.
swaroop-sridhar added a commit to swaroop-sridhar/sdk that referenced this issue May 29, 2020
This commit implements the following changes for single-file apps:
* When publishing self-contained single-file apps:
  * Use `SingleFileHost` instead of `apphost`
  * Trim the native components of the runtime published for the app.
   * Fixes dotnet#11567.

* Implements the [optional additional settings](https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design.md#optional-settings) for .net 5 `PublishSingleFile`.
  * dotnet/runtime#36590
swaroop-sridhar added a commit that referenced this issue Jun 1, 2020
* Use SingleFileHost

This commit implements the following changes for single-file apps:
* When publishing self-contained single-file apps:
  * Use `SingleFileHost` instead of `apphost`
  * Trim the native components of the runtime published for the app.
   * Fixes #11567.

* Implements the [optional additional settings](https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design.md#optional-settings) for .net 5 `PublishSingleFile`.
  * dotnet/runtime#36590

* Address feedback from @dplaisted.

* Update global.json (To include update from runtime)

* Updating stage0 caused crossgen2 tests to fail because of missing dependencies in the corssgen2 package. Therefore two tests are disabled until dotnet/runtime#37196 is fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants