DOT

VVM

 DOCS

Version: |

Create a new project (Command Line)

If you don't have Visual Studio, you can create a new DotVVM project from the command line using .NET Core templates.

Install the template

First, you need to install the dotnet new template for DotVVM from NuGet. To do this, run the following command in the console:

dotnet new -i DotVVM.Templates::*

Please note that this command can take few minutes to execute.

Run the template

When the template is installed, you can run it in an empty directory. The tooling will create a project there:

mkdir ProjectName
cd ProjectName
dotnet new dotvvm

DotVVM Command Line syntax

The project generated by the template contains a reference to DotVVM.CommandLine package.

You can invoke it by calling dotnet dotvvm .... You can use one of the following commands to perform the following tasks:

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
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