Skip to content

Commit

Permalink
Make clarification about Appcontext.BaseDirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
swaroop-sridhar committed Feb 14, 2020
1 parent 3409697 commit 9c9d553
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions accepted/single-file/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ The following settings can be used to package additional files into the single-f
| Property | Behavior when set to `true` |
| ------------------------------------ | ------------------------------------------------------------ |
| `IncludeNativeLibrariesInSingleFile` | Bundle published native binaries into the single-file app. |
| `IncludeAllContentInSingleFile` | Bundle all published files (except symbol files) into single-file app. This option is proposed to replicate the .net core 3 version of single-file apps. |
| `IncludeSymbolsInSingleFile` | Bundle symbol files (IL `.pdb` file, and the native `.ni.pdb` / `app.guid.map` files generated by ready-to-run compiler) into the single file app. |
| `IncludeAllContentInSingleFile` | Bundle all published files (except symbol files) into single-file app. This option is proposed to replicate the .net core 3 version of single-file apps. |

Certain files can be explicitly excluded from being embedded in the single-file by setting following `ExcludeFromSingleFile` meta-data element. For example, to place some files in the publish directory but not bundle them in the single-file:

Expand Down Expand Up @@ -227,11 +227,9 @@ Most of the app development can be agnostic to whether the app is published as s

#### `AppContext.BaseDirectory`

`AppContext.BaseDirectory` will be the directory where the AppHost (the single-file bundle itself) resides.

This is a change from [.net core 3 semantics](design_3_0.md#API-Impact) for single-file apps, where `AppContext.BaseDirectory` returned the directory where the bundle-contents were extracted. In .net 5, extraction is not performed by default. Therefore, the details about extraction directory are not exposed through the `AppContext.BaseDirectory` API.
`AppContext.BaseDirectory` will be the directory where the AppHost (the single-file bundle itself) resides. In contrast to [.net core 3 single-file apps](design_3_0.md), .net 5 single-file apps do not always self-extract on startup. Therefore, the details about extraction directory are not exposed through the `AppContext.BaseDirectory` API.

However, if files not handled by the runtime are bundled into the single-file (due to `IncludeAllContentInSingleFile` property which emulates .net core 3 bundling behavior) the app will need a (new) API to locate the extraction directory.
However, when single file apps are published with `IncludeAllContentInSingleFile` property set (which emulates .net core 3 bundling behavior), `AppContext.BaseDirectory` returns the extraction directory, following [.net core 3 semantics](design_3_0.md#API-Impact).

## Handling Content

Expand Down

0 comments on commit 9c9d553

Please sign in to comment.