Set up an Xperience by Kentico project

This page is part of a tutorial, which you should follow sequentially from beginning to end. Go to the first page: Xperience by Kentico overview.

In this step, you’ll:

Before we start building the site, we’ll first set up a boilerplate project that comes:

  1. with dependencies on all required Xperience NuGet packages
  2. with the startup class configured according to Xperience requirements (registered services and middleware)
  3. automatically configured to connect to the project database

Watch this video to quickly learn how to install Xperience by Kentico projects. However, for the purposes of this tutorial, perform the installation according to the steps below, so that you can easily continue on the following pages.

Install the Xperience project templates package

Xperience provides boilerplate projects distributed as .NET project templates and installed via the .NET command-line tool (included with the .NET SDK).

Before creating new projects, you must install the Xperience by Kentico project templates package using the .NET CLI.

Open the command line prompt and run the following command:

dotnet new -i kentico.xperience.templates

The project templates package is now installed on your computer.

Create an Xperience project and a database

Once you have installed the project templates package, you can create new Xperience projects using the dotnet new command. For this tutorial, we’ll create an empty boilerplate website.

Move to a suitable directory on your filesystem and run the following command:

dotnet new kentico-xperience-mvc -n MEDLABClinic

The command creates a project called MEDLABClinic based on the kentico-xperience-mvc template in your current directory. During the project creation, you’ll encounter the following prompt:

Template is configured to run the following action: 
Description: Restore tools required for this project configuration.
Manual instructions: Run 'dotnet tool restore'
Actual command: dotnet tool restore
Do you want to run this action [Y(yes)|N(no)]?

Type Y to download the database installation tools for the project.

The last thing we need is to set up the database using the downloaded installation tools. Run the following command from the directory where you created the MEDLABClinic project:

dotnet kentico-xperience-dbmanager -- -s "<sql_server_name>" -a "<admin_password>" -d "MEDLABClinic" --license-file "<license_file_path>"

Substitute the placeholder values with:

  • <sql_server_name> – the name of the SQL server where the database will be installed.
  • <admin_password> – the password used for the default administrator account.
  • <license_file_path> – the absolute or relative path to a text file with your product license. You can obtain a developer license in the Xperience client portal.

To see the complete list of available commands, run dotnet kentico-xperience-dbmanager -- --help.

That’s it for the installation process. We now have a basic project together with a database.

Set up local hosting

You often need to build and test code changes quickly when developing websites. For this reason, it’s helpful to have the site hosted locally on your machine. In this aspect, ASP.NET Core is very flexible, as it supports multiple hosting options.

We’ll use the Kestrel web server to host our application for this tutorial. Kestrel is cross-platform and comes included by default with .NET installations. To launch the installed website, execute the following command in the directory where you created the project and installed its database:

dotnet run

You should see output similar to the following in the terminal:

info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:4347
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: <path_to_project_directory>

Enter the URL from the second line into your browser (e.g., http://localhost:4347, but with a different port number) to view the created site.

There’s not much to see yet, but we’ll get to that in the following steps. For now, you can take a look at the Xperience administration – add /admin to your site’s URL and sign in using the default administrator account and the password you specified when installing the project database. 

Xperience interface basics

Now is a good time to take a look at Administration interface basics – a short overview of the Xperience administration and its common navigation and interaction patterns. 

Let’s continue with the next part of the tutorial, where we’ll learn how to configure Xperience for the installed site and enable some of the features we’ll need later.

Previous page: Xperience by Kentico overview — Next page: Configure the application

Completed pages: 2 of 9