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: aspnetcore/blazor/host-and-deploy/index.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,8 +28,10 @@ Apps are published for deployment in Release configuration.
28
28
# [Visual Studio](#tab/visual-studio)
29
29
30
30
1. Select the **Publish {APPLICATION}** command from the **Build** menu, where the `{APPLICATION}` placeholder the app's name.
31
-
1. Select the *publish target*. To publish locally, select **Folder**.
32
-
1. Accept the default location in the **Choose a folder** field or specify a different location. Select the **`Publish`** button.
31
+
1. Select the *publish target*. To publish locally, select **Folder**. Select **Next**.
32
+
1. Accept the default folder location or specify a different location. Select **Finish** and select **Close**.
33
+
1. To clean the publish folder prior to publishing the app, select **Show all settings** followed by **Settings** > **File Publish Options** > **Delete all existing files prior to publish**, followed by **Save**.
34
+
1. Select the **`Publish`** button.
33
35
34
36
# [.NET CLI](#tab/net-cli)
35
37
@@ -39,6 +41,16 @@ Use the [`dotnet publish`](/dotnet/core/tools/dotnet-publish) command to publish
39
41
dotnet publish -c Release
40
42
```
41
43
44
+
The `dotnet publish` command generates the necessary files for deployment based on the current state of the project and places the files into the specified output folder. The command doesn't automatically clean the target folder before publishing the app.
45
+
46
+
To empty the target folder automatically before the app is published, add the following MSBuild target to the app's project file:
Publishing the app triggers a [restore](/dotnet/core/tools/dotnet-restore) of the project's dependencies and [builds](/dotnet/core/tools/dotnet-build) the project before creating the assets for deployment. As part of the build process, unused methods and assemblies are removed to reduce app download size and load times.
0 commit comments