Fork me on GitHub

DotVVM 1.1 RC 5, dotnet new and DotVVM CLI

Published: February 18, 2017

Few days ago, we have released the DotVVM 1.1 RC5 to the official NuGet feed. It contains several bug fixes and tweaks.

The RTM version of DotVVM 1.1 will be released on 7th March 2017, the same day when Microsoft releases Visual Studio 2017.

 

Command Line Experience

A new feature which wasn’t available before, is the command line experience in DotVVM, which works also on Linux and Mac OS X.

Recently, Scott Hanselman wrote an article about dotnet new templates. We have decided to create such template for DotVVM, and finish the DotVVM CLI tool which helps to create pages and viewmodels from the command line.

 

1. To try out, you need to install the .NET Core SDK 1.0.0 RC4.

 

2. Create a new directory for your project:

mkdir DotvvmDemo
cd DotvvmDemo

 

3. The dotnet new command includes several built-in templates. To install DotVVM template, you need to run this command in the command line:

dotnet new -i DotVVM.Templates::1.1.0-rc5

Note: This took quite long on my machine, the tool fetched about 100 packages. Wait until the script continues – it should list all the templates you have installed and you should see DotVVM template there.

Installing DotVVM dotnet new template

 

4. Now we can create a new DotVVM web app. Run the following command:

dotnet new dotvvm

It should create all the files needed for DotVVM to work.

Empty DotVVM app

This also installs the DotVVM CLI NuGet package in the project file, so you can run dotnet dotvvm something to invoke DotVVM command-line tasks.

 

5. Before we run the app, we need to restore the NuGet packages.

dotnet restore

 

6. Now we can run the app and test that it works:

dotnet run

In your web browser, navigate to http://localhost:5000/. You should see the familiar “Hello from DotVVM!” page.

To shut down the app, press Ctrl-C in the console window.

 

7. You can add a master page to the project. You can run this script:

dotnet dotvvm add master Site

It creates the Views/Site.dotmaster and ViewModels/SiteViewModel.cs file.

Notes:

- DotVVM CLI supports also shorter syntax – dotnet dotvvm am Site

- You can specify full path to the master page file – e.g. dotnet dotvvm am Views/Admin/Admin.dotmaster

 

8. Now we can add a new page and embed it in the master page we have just created.

dotnet dotvvm add page Gallery --master Site

It will create the Views/Gallery.dothtml page with the appropriate viewmodel which is nested in the Site.dotmaster page.

Notes:

- The short version is dotnet dotvvm ap Gallery -m Site

 

You can also create markup controls using dotnet dotvvm ac Rating. If you want to create a code behind file, add the -c switch.

 

We are still working on the detailed documentation for the DotVVM CLI and of course you’ll get more features soon. We are planning to create a simple integration into Visual Studio Code with a very basic IntelliSense.

Tomáš Herceg

Tomáš Herceg

I am the CEO of RIGANTI, small software development company located in Prague, Czech Republic.

I am a Microsoft Regional Director and Microsoft Most Valuable Professional.

I am the author of DotVVM, an open source .NET-based web framework which lets you build Line-of-Business applications easily and without writing thousands lines of Javascript code.

DotVVM 1.1 RC 5, dotnet new and DotVVM CLI

Published: February 18, 2017

Few days ago, we have released the DotVVM 1.1 RC5 to the official NuGet feed. It contains several bug fixes and tweaks.

The RTM version of DotVVM 1.1 will be released on 7th March 2017, the same day when Microsoft releases Visual Studio 2017.

 

Command Line Experience

A new feature which wasn’t available before, is the command line experience in DotVVM, which works also on Linux and Mac OS X.

Recently, Scott Hanselman wrote an article about dotnet new templates. We have decided to create such template for DotVVM, and finish the DotVVM CLI tool which helps to create pages and viewmodels from the command line.

 

1. To try out, you need to install the .NET Core SDK 1.0.0 RC4.

 

2. Create a new directory for your project:

mkdir DotvvmDemo
cd DotvvmDemo

 

3. The dotnet new command includes several built-in templates. To install DotVVM template, you need to run this command in the command line:

dotnet new -i DotVVM.Templates::1.1.0-rc5

Note: This took quite long on my machine, the tool fetched about 100 packages. Wait until the script continues – it should list all the templates you have installed and you should see DotVVM template there.

Installing DotVVM dotnet new template

 

4. Now we can create a new DotVVM web app. Run the following command:

dotnet new dotvvm

It should create all the files needed for DotVVM to work.

Empty DotVVM app

This also installs the DotVVM CLI NuGet package in the project file, so you can run dotnet dotvvm something to invoke DotVVM command-line tasks.

 

5. Before we run the app, we need to restore the NuGet packages.

dotnet restore

 

6. Now we can run the app and test that it works:

dotnet run

In your web browser, navigate to http://localhost:5000/. You should see the familiar “Hello from DotVVM!” page.

To shut down the app, press Ctrl-C in the console window.

 

7. You can add a master page to the project. You can run this script:

dotnet dotvvm add master Site

It creates the Views/Site.dotmaster and ViewModels/SiteViewModel.cs file.

Notes:

- DotVVM CLI supports also shorter syntax – dotnet dotvvm am Site

- You can specify full path to the master page file – e.g. dotnet dotvvm am Views/Admin/Admin.dotmaster

 

8. Now we can add a new page and embed it in the master page we have just created.

dotnet dotvvm add page Gallery --master Site

It will create the Views/Gallery.dothtml page with the appropriate viewmodel which is nested in the Site.dotmaster page.

Notes:

- The short version is dotnet dotvvm ap Gallery -m Site

 

You can also create markup controls using dotnet dotvvm ac Rating. If you want to create a code behind file, add the -c switch.

 

We are still working on the detailed documentation for the DotVVM CLI and of course you’ll get more features soon. We are planning to create a simple integration into Visual Studio Code with a very basic IntelliSense.

Tomáš Herceg

Tomáš Herceg

I am the CEO of RIGANTI, small software development company located in Prague, Czech Republic.

I am a Microsoft Regional Director and Microsoft Most Valuable Professional.

I am the author of DotVVM, an open source .NET-based web framework which lets you build Line-of-Business applications easily and without writing thousands lines of Javascript code.