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

Publish unpackaged apps #1864

Merged
merged 4 commits into from
Nov 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Edits.
davidbritch committed Nov 8, 2023
commit 20f1227a9ad7207e98040d6d0f0e3e9e5f13184b
2 changes: 1 addition & 1 deletion docs/windows/deployment/publish-cli.md
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@ To publish your app, open the **Developer Command Prompt for VS 2022** terminal
|------------------------------|-------------------------------------------------------------------------------------|
| `-f` | The target framework, which is `net7.0-windows{version}`. This value is a Windows TFM, such as `net7.0-windows10.0.19041.0`. Ensure that this value is identical to the value in the `<TargetFrameworks>` node in your *.csproj* file. |
| `-c` | The build configuration, which is `Release`. |
| `-p:RuntimeIdentifierOverride=win10-x64`<br>- or -<br>`-p:RuntimeIdentifierOverride=win10-x86` | Avoids the bug detailed in [WindowsAppSDK Issue #2940](https://github.com/microsoft/WindowsAppSDK/issues/2940). Choose the `-x64` or `-x86` version of the parameter based on your target platform.
| `-p:RuntimeIdentifierOverride=win10-x64`<br>- or -<br>`-p:RuntimeIdentifierOverride=win10-x86` | Avoids the bug detailed in [WindowsAppSDK Issue #3337](https://github.com/microsoft/WindowsAppSDK/issues/3337). Choose the `-x64` or `-x86` version of the parameter based on your target platform.

> [!WARNING]
> Attempting to publish a .NET MAUI solution will result in the `dotnet publish` command attempting to publish each project in the solution individually, which can cause issues when you've added other project types to your solution. Therefore, the `dotnet publish` command should be scoped to your .NET MAUI app project.
13 changes: 7 additions & 6 deletions docs/windows/deployment/publish-unpackaged-cli.md
Original file line number Diff line number Diff line change
@@ -32,27 +32,28 @@ To publish your app, open the **Developer Command Prompt for VS 2022** terminal

| Parameter | Value |
|------------------------------|-------------------------------------------------------------------------------------|
| `-f` | The target framework, which is `net7.0-windows{version}`. This value is a Windows TFM, such as `net7.0-windows10.0.19041.0`. Ensure that this value is identical to the value in the `<TargetFrameworks>` node in your *.csproj* file. |
| `-f` | The target framework, which is `net8.0-windows{version}`. This value is a Windows TFM, such as `net8.0-windows10.0.19041.0`. Ensure that this value is identical to the value in the `<TargetFrameworks>` node in your *.csproj* file. |
| `-c` | The build configuration, which is `Release`. |
| `-p:WindowsPackageType=None` | Indicates to the publish command that there should be no package. |
| `-p:RuntimeIdentifierOverride=win10-x64`<br>- or -<br>`-p:RuntimeIdentifierOverride=win10-x86` | Avoids the bug detailed in [WindowsAppSDK Issue #3337](https://github.com/microsoft/WindowsAppSDK/issues/3337). Choose the `-x64` or `-x86` version of the parameter based on your target platform. |
| `-p:WindowsPackageType` | The package type, which is `None` for unpackaged apps. |
| `-p:WindowsAppSDKSelfContained` | The deployment mode for your app, which can be framework-dependent or self-contained. This value should be `true` for self-contained apps. For more information about framework-dependent apps and self-contained apps, see [Windows App SDK deployment overview](/windows/apps/package-and-deploy/deploy-overview). |

> [!WARNING]
> Attempting to publish a .NET MAUI solution will result in the `dotnet publish` command attempting to publish each project in the solution individually, which can cause issues when you've added other project types to your solution. Therefore, the `dotnet publish` command should be scoped to your .NET MAUI app project.

For example:

```console
dotnet publish -f net7.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None
dotnet publish -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None
```

Publishing builds the app, copying the executable to the _bin\\Release\\net7.0-windows10.0.19041.0\\win10-x64\\publish_ folder. In this folder, there's an _exe_ file, and that's the built app. This app can be launched or the entire folder can be copied to another machine and launched there.
Publishing builds the app, copying the executable to the _bin\\Release\\net8.0-windows10.0.19041.0\\win10-x64\\publish_ folder. In this folder, there's an _exe_ file, and that's the built app. This app can be launched or the entire folder can be copied to another machine and launched there.

One important distinction from a packaged app is that this will _NOT_ include the .NET runtime in the folder. This means that the app will require the .NET runtime to first be installed on the machines that will eventially run the app. To ensure the app also contains _all_ the runtime components, the `--self-contained` argument can be provided when publishing.
For example:
An important distinction from a packaged app is that this won't include the .NET runtime in the folder. This means that the app will require the .NET runtime to first be installed on the machines that will eventually run the app. To ensure the app also contains all the runtime components, the `-p:WindowsAppSDKSelfContained` argument can be provided when publishing. For example:

```console
dotnet publish -f net7.0-windows10.0.19041.0 -c Release --self-contained -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None
dotnet publish -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true
```

For more information about the `dotnet publish` command, see [dotnet publish](/dotnet/core/tools/dotnet-publish).