Support Single-File Apps in .NET 5
source link: https://github.com/dotnet/runtime/issues/36590
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The goal of this effort is enable .Net-Core apps to be published and distributed as a single executable.
Goals
The .Net 5.0 single file solution should be:
- Widely compatible: Apps containing IL assemblies, ready-to-run assemblies, composite assemblies, native binaries, configuration files, etc. can be packaged into one executable.
- Can run managed components of the app directly from bundle, without need for extraction to disk.
- Usable with debuggers and tools.
User Experience
Here's the overall experience for publishing a HelloWorld single-file app in .net 5:
-
Framework-dependent
- Publish command:
- Published files: ,
-
Self-contained (Linux)
- Publish command:
- Published files: ,
-
Self-contained (Windows):
- Publish command:
- Published files: , , , , ,
-
Self-contained (Windows) with bundled native components:
- Publish command:
- Published files: ,
Design Document
A detailed discussion of the goals, non-goals, related-work, options, design decisions, and implementation details of supporting single-file apps is available in this design document
Tracking Progress
-
Initial proposal and poll for customer response:
- Poll on GitHub: #11201
- Propose staged implementation of the feature.
-
Support single-file apps through extraction (.net core 3)
- Self-Extractor Design .
- SDK support for publishing apps as a single-file. dotnet/sdk#3132
- AppHost support for extracting contents of a single-file bundle at startup. dotnet/core-setup#5742
-
Support single-file apps running from bundle (.net 5)
-
HostModel library
- Implement bundle format version 2 . dotnet/core-setup#5742
-
SDK
- Implement support for publishing a few files when necessary for . dotnet/sdk#11586
- Implement optional settings for single-file publishing.
- Use SingleFileHost when publishing self-contained single-file apps. dotnet/sdk#11567
- Trim the set of native dependencies used for single-file publish. #36578
- Host
- Host Builds
-
Runtime
- Load assemblies directly from bundle . #36052
- Dependency resolution: Resolve assemblies from bundle . #36052
-
APIs
- should return the location of the single-file executable #34274
-
HostModel library
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK