Configuring your MVC Application / Using Visual Studio Template
Using Visual Studio Template

Visual Studio Project template allows you to create a simple ASP.NET Core MVC application. To use C1 MVC controls, few additional steps are required to configure the project created using the basic Visual Studio project template.

  1. Open Visual Studio and Select Create a new project.
  2. In the Create a new project window, select ASP.NET Core Web Application and click Next.
    Visual Studio Create New Project Window
  3. In the Configure your new project window, write your project name, choose location to save your project and click Create.
    Visual Studio Configure your new project window
  4. In the Create a new ASP.NET Core web application window, select the ASP.NET Core version, say ASP.NET Core 3.1, and click Create.
    Visual Studio Core version Selection window
  5. From the Solution Explorer, expand the folder Views and double click the _ViewImports.cshtml file to open it.
  6. In the _ViewImports.cshtml file, add the following code.
    HTML
    Copy Code
    @addTagHelper *, C1.AspNetCore.Mvc
    
  7. (Optional) To add specific controls in your application, you need to add the following TagHelpers in  the _ViewImports.cshtml file.

    Control TagHelper
    Financial Chart
    @addTagHelper *, C1.AspNetCore.Mvc.Finance
    
    FlexSheet
    @addTagHelper *, C1.AspNetCore.Mvc.FlexSheet
    
    OLAP
    @addTagHelper *, C1.AspNetCore.Mvc.Olap
    
    MultiRow
    @addTagHelper *, C1.AspNetCore.Mvc.MultiRow
    
    FlexViewer
    @addTagHelper *, C1.AspNetCore.Mvc.FlexViewer
    
    TransposedGrid
    @addTagHelper *, C1.AspNetCore.Mvc.TransposedGrid
    
    TransposedMultiRow
    @addTagHelper *, C1.AspNetCore.Mvc.TransposedMultiRow
    
  8. Add the ASP.NET MVC Core Edition references to the project. In the Solution Explorer, right click References and select Manage NuGet Packages. In NuGet Package Manager, select https://api.nuget.org/v3/index.json as the Package source. Search for C1.AspNetCore.Mvc package, and click Install.
    Nuget Package Manager

    Note: "C1.AspNetCore.Mvc" gets added under the "dependencies" within project.json file of your project once you restore the packages.

  9. To use specific controls in your application, add the following NuGet Packages based on the control.

    Control NuGet Package
    Financial Chart
    C1.AspNetCore.Mvc.Finance
    
    FlexSheet
    C1.AspNetCore.Mvc.FlexSheet
    
    OLAP
    C1.AspNetCore.Mvc.Olap
    
    MultiRow
    C1.AspNetCore.Mvc.MultiRow
    
    FlexViewer
    C1.AspNetCore.Mvc.FlexViewer
    
    TransposedGrid
    C1.AspNetCore.Mvc.TransposedGrid
    
    TransposedMultiRow
    C1.AspNetCore.Mvc.TransposedMultiRow
    

  10. To add a license, right-click the solution name from the Solution Explorer or go to the Tools menu, and then select MESCIUS License Manager. Optionally, you can also generate runtime license key and add it to your application. For more information on generating license, see Licensing topic.
  11. After completing the steps above, register the resources for the controls to be used in the application. For more information, see Registering Resources.
  12. Add map route using the following line of code (highlighted in bold) in the Configure method, Startup.cs file (For MVC Core 3.0 apps).
    app.UseEndpoints(endpoints =>
    {
       endpoints.MapRazorPages();
       endpoints.MapControllers();
    });