Blazor

Introducing the Syncfusion Blazor Code Generator for Visual Studio

Syncfusion provides a Blazor Code Generator extension to add Syncfusion Blazor component code in Razor files and configure a Blazor application with Syncfusion. It generates Syncfusion Blazor component code very quickly with its required inputs and features.  In this blog, I am going to explain how to install the Syncfusion Code Generator extension and how to add a Syncfusion Blazor component using it.

Prerequisites

Installing Syncfusion Blazor Code Generator extension

The Syncfusion Blazor Code Generator extension for Visual Studio 2019 is available in the Syncfusion Blazor setup as of Essential Studio 2021 Volume 1. You can either install it from Visual Studio or download and install it from Visual Studio Marketplace.

Installing through Visual Studio Manage Extensions

The following steps illustrate how to install the extensions for Syncfusion Blazor from Visual Studio 2019 Manage Extensions:

  1. Open Visual Studio 2019.
  2. Open Manage Extensions in the Extension menu.
  3. Select the Online tab on the left and type “Syncfusion Blazor” in the search box.
  4. Click the Syncfusion Blazor Template Studio extension, then click Download.

    Note: The Syncfusion Blazor Code Generator was shipped within the Syncfusion Template Studio.

  1. Once the extensions have been downloaded, close all Visual Studio instances to start the installation process. You will see the following VSIX installation prompt.
  1. Click Install.

Install from the Visual Studio Marketplace

The following steps illustrate how to download and install the Syncfusion Blazor Template Studio with the Code Generator extension from the Visual Studio Marketplace.

Note: Syncfusion Blazor Code Generator was shipped within the Syncfusion Template Studio.

  1. Download the Syncfusion Blazor Template Studio from the Visual Studio Marketplace.
  2. Close all Visual Studio instances running, if any.
  3. To install, double-click the downloaded VSIX file. You will see the VSIX installation prompts for the Visual Studio 2019 version. If  you don’t install the Visual Studio 2019, then it will not be possible to install the extension.
  4. Click Install.

How to use the Syncfusion Blazor Code Generator

The following steps illustrate how to add Syncfusion Blazor component code using the Syncfusion Code Generator:

  1. Open the Blazor application to which you want to add the Syncfusion Blazor component.
  2. To open the Syncfusion Blazor Code Generator wizard, follow one of these options in the Razor file:
    Option 1:Right-click in the Razor file code editor at the line position where you want to add a Syncfusion Blazor component and select the Syncfusion Blazor Code Generator. Option 2:Place the cursor in the required line in the Razor code editor and choose Extension -> Syncfusion -> Essential Studio for Blazor -> Syncfusion Blazor Code Generator from the Visual Studio Menu.
  3. The Syncfusion Blazor Code Generator wizard will appear. Select the required control.
    Data Binding: In this section, you can see the data operation fields if the selected control has required data. The data is listed from your application. It interacts with data models and reduces the amount of time to develop with data operations in your project. You can choose the required data model class, data source, ID, and more from your application.

    Features: In this section, you can see the list of control features for the selected control. You can choose the required features.

    Control Requirements: In this section, you can see the required user input fields for the selected control. You can provide the required values for those fields to generate the control code.

  4. After providing the input, click Insert. The selected control’s render code is generated and inserted at the cursor’s position. The project is configured with the required NuGet package, namespaces, styles, and services.
  5. In the output window, you will see the information about the changes made by the Syncfusion Blazor Code Generator.

Conclusion

I hope you now have a clear idea about how to install the Syncfusion Blazor Code Generator and add a Syncfusion Blazor component using it. The Syncfusion Blazor Code Generator helps developers to add Syncfusion Blazor component code in less time.

Syncfusion has 1,600 components and frameworks for WinFormsWPFWinUI, ASP.NET (Web FormsMVCCore), UWPXamarinFlutterJavaScriptAngularBlazorVue, and React. Use them to boost your application development speed.

If you aren’t a Syncfusion customer yet, you can try our 30-day free trial to check out our features. Also, try our samples from this GitHub location.

If you wish to send us feedback, please use the comments section below. If you would like to submit any questions, please feel free to contact us through our support forumDirect-Trac, or feedback portal. We are always happy to assist you!

If you like this blog post, we think you’ll also like the following articles too:

Kalirajan Ganesan

Kalirajan is Software Engineer in Syncfusion. He has been .NET developer since 2016. He is currently working with Visual Studio extensions and Visual Studio for Mac extensions and helps configure the Syncfusion component in applications