Creating a Syncfusion® Blazor application
12 Dec 20245 minutes to read
Syncfusion® provides Visual Studio Code project templates for creating Syncfusion® Blazor application. Syncfusion® Blazor generates application that include the necessary Syncfusion® NuGet packages, namespaces, and component render code for the Calendar, Button, and DataGrid components, as well as the style for making Syncfusion® component development easier.
NOTE
Blazor project templates from
v17.4.0.39
are supported by the Syncfusion® Visual Studio Code project template.
The instructions below assist you in creating Syncfusion Blazor Applications using Visual Studio Code:
-
To create a Syncfusion® Blazor application in Visual Studio Code, open the command palette by pressing Ctrl+Shift+P. Search for the word Syncfusion in the Visual Studio Code palette to get the templates provided by Syncfusion®.
-
Select Syncfusion Blazor Template Studio: Launch, then press Enter key. The Template Studio wizard for configuring the Syncfusion® Blazor app will be launched. Provide the Project Name and Project Path.
NOTE
Refer to the .NET SDK support for Syncfusion® Blazor Components here.
-
Select either Next or the Project Type tab. Syncfusion® Blazor project types will be displayed. Choose one of the following Syncfusion® Blazor project types based on the version of the .NET SDK you are using.
.NET SDK version Supported Syncfusion Blazor Application Type .NET 9.0, .NET 8.0 Syncfusion Blazor Web App .NET 9.0, .NET 8.0, .NET 7.0, .NET 6.0 Syncfusion Blazor WebAssembly App .NET 7.0, .NET 6.0 Syncfusion Blazor Server App In the Syncfusion Blazor Web App application type, you can configure the following options:
Interactivity type Server, WebAssembly, Auto (Server and WebAssembly) Interactivity location Global, Per page/component In the Syncfusion Blazor WebAssembly App application type, you can choose ASP.NET Core hosted, Progressive Web Application, or both.
-
The Configuration section will be displayed when you click either Next or the Configuration tab. Here, you have the option for selecting the required .NET Core version, themes, https configuration, and Blazor Web Assembly project types (ASP.NET Core hosted and Progressive Web Application).
NOTE
ASP.NET Core hosted and Progressive Web Application options are only visible if Blazor Web Assembly App project type is selected.
-
Click the Create button. The Syncfusion® Blazor application has been created. The created Syncfusion® Blazor app has the Syncfusion® NuGet packages, styles, and the component render code for the Syncfusion® component added to the Index, Counter, and FetchData pages.
-
You can run the application to see the Syncfusion® components. Click F5 or go to Run>Start Debugging.
-
If you installed the trial setup or NuGet packages from nuget.org you must register the Syncfusion® license key to your application since Syncfusion® introduced the licensing system from 2018 Volume 2 (v16.2.0.41) Essential Studio® release. Navigate to the help topic to generate and register the Syncfusion® license key to your application. Refer to this UG topic for understanding the licensing details in Essential Studio® for Blazor.
Syncfusion® integration
The Syncfusion® Blazor application configures with latest Syncfusion® Blazor NuGet packages, styles, namespaces, and component render code for Syncfusion® components are added in the created application.
NuGet Packages
The Syncfusion.Blazor
NuGet package will be added as NuGet references for all application types.
Style
The selected theme is added from Syncfusion® NuGet and its reference at these applications locations in Blazor.
Application type | File location |
---|---|
Syncfusion Blazor Web App | ~/Components/App.razor |
Syncfusion Blazor Server App | {Project location}/Pages//_Host.cshtml |
Syncfusion Blazor WebAssembly App (ASPNET Core hosted) Syncfusion Blazor WebAssembly App (Progressive Web Application) |
{Client Project location}/wwwroot/index.html |
Syncfusion Blazor WebAssembly App | {Project location}/wwwroot/index.html |
Namespaces
The Syncfusion® Blazor namespaces are added in the _imports.razor
file.
Component render code
The Syncfusion® Blazor Calendar, Button, and DataGrid component render code is in the Razor files in the pages folder. The render code is updated in these Razor files.
File name | Code snippet added |
---|---|
~/Pages/Home.razor or Index.razor |
|
~/Pages/Counter.razor |
|
~/Pages/FetchData.razor |