DotVVM Command Line

When you create DotVVM project (ASP.NET Core) using DotVVM for Visual Studio or using dotnet new, the DotVVM Command Line tool should be already registered in the project file:

<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
    <DotNetCliToolReference Include="DotVVM.CommandLine" Version="2.0.0" />

This will allow to run commands starting with dotnet dotvvm ... in the project directory to perform various actions with the DotVVM project.

Creating Pages, Master Pages and Markup Controls

DotVVM Command Line can create new pages, master pages and markup controls in ASP.NET Core projects.

Task Short Syntax Long Syntax Options
Create Page dotnet dotvvm ap dotnet dotvvm add page
  • {PageName} - name of the page or path of the `.dothtml` file
  • -m {MasterPage} - (optional) name or path of the master page
Create Master Page dotnet dotvvm am dotnet dotvvm add master
  • {PageName} - name of the page or path of the `.dotmaster` file
Create Markup Control dotnet dotvvm ac dotnet dotvvm add control
  • {ControlName} - name of the control or path of the `.dotcontrol` file
  • -c - (optional) create a code-behind file for the control


  1. Create the Views/Site.dotmaster master page:
dotnet dotvvm add master Site
  1. Create the Views/Page1.dothtml page and embed it in the Views/Site.dotmaster:
dotnet dotvvm add page Page1 -m Site
  1. Create the Controls/MyControl.dotcontrol user control with the code behind file:
dotnet dotvvm add control Controls/MyControl.dotcontrol -c

Working with REST API Binding clients

This feature is new in DotVVM 2.0.

The DotVVM Command Line tool can also be used to add and update REST API Bindings clients.

Task Syntax Options
Add API Client dotnet dotvvm api create
  • {SwaggerJsonUrl} - URL of the Swagger JSON metadata
  • {Namespace} - namespace in which the API clients will be declared
  • {CSharpClientPath} - relative path to the generate C# client file
  • {TypescriptClientPath} - relative path to the generate TypeScript client file
Update API Client dotnet dotvvm api regen
  • {SwaggerJsonUrl} - (optional) URL of the Swagger JSON metadata; if not specified, all clients will be regenerated

The metadata of REST API Bindings are stored in dotvvm.json file. If any of the parameters needs to be updated, change them in this file.

Please note that the API client needs to be registered in DotvvmStartup.cs. See REST API Bindings chapter for more details.


  1. Registering the API client:
dotnet dotvvm api create http://localhost:43852/swagger/v1/swagger.json DotVVM2.Demo.RestApi.Api Api/ApiClient.cs wwwroot/Scripts/ApiClient.ts
  1. Updating the generated clients:
dotnet dotvvm api regen

On this page