Version: |

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">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  ...
  <ItemGroup>
    <DotNetCliToolReference Include="DotVVM.CommandLine" Version="1.1.0" />
  </ItemGroup>
</Project>

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

Examples

  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

Support for REST API Bindings was added in DotVVM 2.0.

Next Chapter

Suggestions


Help & Contribute

The documentation is maintained on GitHub.
We'll be happy if you edit the page and create a pull request.

Send message