Deployment in Blazor

9 Nov 20211 minute to read

This section provides information about deploying Blazor applications with the Syncfusion Blazor components.

You can get more information about deploying Blazor applications Here.

Publish Blazor Application with Visual Studio 2019

  • Create the Blazor application with Syncfusion Blazor Components.

    You have to change the base path of the application. Refer to the MSDN for more details.

  • Right-click on the project in the Solution Explorer and select Publish.

Solution Explorer

  • Then, select the Folder option and select the publishing target location.

Publish Location

  • Check the configuration as Release by clicking the Advanced... option below the target location.

Release Configuration

  • For Blazor Server side application, Set Deployment Mode as Self-Contained. Because some dependencies are not loaded properly when we host the published folder.

Deploy Mode

  • Then, click Save and Publish.

    Refer here for publishing the application to Azure App Service using Visual Studio.

Publish Blazor Application with CLI

Packing the application and its dependencies into a folder for deployment to a hosting system by using the dotnet publish command.

For CLI deployment, run the following command from your root directory.

dotnet publish -c Release

For Blazor Server CLI deployment.

dotnet publish -c Release --self-contained true -r win-x86

Refer to the dotnet publish's optional arguments.

Output location

Use the following command to specify the path for the output directory.

dotnet publish -c Release -o <output directory>

If the output directory is not specified, it defaults to ./bin/[configuration]/[framework]/publish/ for a framework-dependent deployment or ./bin/[configuration]/[framework]/[runtime]/publish/ for a self-contained deployment.

If the path is relative, the output directory generated is relative to the project file location, not to the current working directory.

Also, refer to the MSDN reference here.

Now, you can host the published folder by using the IIS or Azure app service.

See Also