You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,6 +152,7 @@ Native host mode:
152
152
- On Linux/macOS, alias command paths (`pwsh-*`) are hard links to `multi-pwsh`.
153
153
-`multi-pwsh doctor --repair-aliases` performs a shim health check and re-links broken hard links automatically.
154
154
- You can still manually copy/rename `multi-pwsh.exe` under `MULTI_PWSH_BIN_DIR` (default: `~/.pwsh/bin`) to an alias-like name (for example `pwsh-7.4.exe`); it automatically enters host mode and resolves the target installation from that alias name.
155
+
- A `.NET 10` bundled-host sample that publishes the packaged `pwsh.exe` from the `PowerShell` NuGet payload alongside `pwsh.dll` lives under `dotnet\samples\BundledPwshHost\README.md`.
155
156
-`-NamedPipeCommand <pipeName>` is supported in host mode (Windows only), matching `pwsh-host` behavior.
<BundledPwshTargetPlatformCondition="'$(BundledPwshTargetPlatform)' == '' and ($([System.String]::Copy('$(RuntimeIdentifier)').StartsWith('linux')) or $([System.String]::Copy('$(RuntimeIdentifier)').StartsWith('osx')))">unix</BundledPwshTargetPlatform>
- reference `Microsoft.PowerShell.SDK` from managed code;
7
+
- publish a merged PowerShell-style output;
8
+
- use the `pwsh.exe` shipped in the `PowerShell` NuGet package;
9
+
- boot `pwsh.dll` from the publish directory without depending on a separately installed PowerShell.
10
+
11
+
## What the publish step does
12
+
13
+
`dotnet publish` for this sample:
14
+
15
+
1. publishes the sample app as a self-contained `.NET 10` app;
16
+
2. overlays the `PowerShell` NuGet package payload (`pwsh.exe`, `pwsh.dll`, `pwsh.deps.json`, modules, and related files);
17
+
4. rewrites `pwsh.runtimeconfig.json` to the local `.NET 10` shared framework version;
18
+
5. copies the matching shared runtime folders from the local dotnet installation into `publish\shared\...`.
19
+
20
+
The bundled `pwsh.exe` is the official apphost that ships inside the `PowerShell` NuGet package payload. The sample keeps that executable and adjusts the runtime layout around it so it can start against the local `.NET 10` runtime copied into the publish output.
21
+
22
+
The package versions are intentionally linked: the `PowerShell` payload package reuses the same version property as `Microsoft.PowerShell.SDK` (`BundledPwshSdkVersion`), so changing the SDK version automatically changes the imported `pwsh.exe` / `pwsh.dll` payload version too.
23
+
24
+
## Prerequisites
25
+
26
+
Publish the sample from this directory so the local `global.json` selects `.NET 10`:
-`BundledPwshHost.exe` shows a PowerShell SDK invocation result;
49
+
-`pwsh.exe` reports the sample publish directory as `$PSHOME`;
50
+
-`pwsh.exe` reports the local `.NET 10` runtime version from the bundled layout.
51
+
52
+
## Current notes
53
+
54
+
- The payload selection logic is RID-aware (`win` / `unix`), but the validated path in this repository session is `win-x64`.
55
+
- The PowerShell packages currently emit `NU1903` vulnerability warnings for transitive dependencies during publish. The sample does not suppress them.
56
+
- This sample is a proof of concept for local hosting layout. It intentionally favors clarity and reproducibility over minimal output size.
0 commit comments