Set up an Xperience by Kentico project
This page is part of a series you should follow sequentially from beginning to end. Go to the first step.
Before you begin building the site, you need to set up an Xperience project.
Xperience provides .NET project templates you can install via the .NET command-line tool (included with the .NET SDK).
A template is a great place to start because it comes with:
- all required Xperience NuGet package dependencies
- the startup class, configured according to Xperience requirements (registered services and middleware)
- automatic database connection configuration
Install the Xperience project templates package
We will work with the Xperience by Kentico version 29.3.0 in this series.
If you have previously installed other versions of Xperience on your machine, we recommend clearing any unwanted templates first.
Run the following command in your command line prompt:
dotnet new install kentico.xperience.templates::29.3.0 --force
If you have other Xperience templates on your machine (for example after playing around with the latest version), the --force
parameter will ensure the 29.3.0 version gets installed correctly.
You should see an output showing you have successfully installed three project templates on your computer:
Create a project
Let’s use the Boilerplate template (kentico-xperience-mvc
) to create an empty project called Kickstart.Web.
Navigate to your desired project directory and add the following folder structure: ~/src/Kickstart.Web.
The src folder will hold the .NET solution.
The Kickstart.Web will contain the top-level MVC project responsible for the site presentation.
Navigate to the Kickstart.Web directory in your command line tool and create your new project:
dotnet new kentico-xperience-mvc -n Kickstart.Web
You will encounter the following prompt during the project creation:
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)]?
Agree by typing Y
.
After the successful run, you should see a new .NET project generated in your Kickstart.Web directory.
Add a solution
Adding a solution file will allow other projects to work in tandem with Kickstart.Web and keep things organized.
You can add a solution via the .NET CLI or using an IDE of your choice.
Some IDEs, like Visual Studio or Visual Studio Code with the C# Dev Kit extension, will generate the solution file automatically after you open the project. We recommend saving it in the src folder, one level up from Kickstart.Web.
For example, if you are using Visual Studio:
- Open Kickstart.Web.csproj in Visual Studio, and highlight the auto-generated solution in the solution explorer.
- Click on File, and choose Save Kickstart.Web.sln as from the dropdown.
- Navigate to the src folder, and rename the file to Kickstart.sln, then click Save.
Adjust the target framework
The installed template targets .NET 6 by default. Before proceeding with this series, change the target framework to .NET 8.
Assign a license
In the src directory, create a new folder called License.
Add a file called license.txt with the content of a valid localhost license key.
Getting your license key
You can obtain the license key from your agency, supervisor, or team lead.
Alternatively, you can create an account at the Client Portal, and generate a temporary key valid for 30 days.
Learn more about licensing in our documentation.
Connect the database
The last thing we need is to set up the database.
Run this command from the ~/src/Kickstart.Web directory:
dotnet kentico-xperience-dbmanager -- -s "<sql_server_name>" -a "kickstart" -d "Xperience.Kickstart" --license-file "..\License\license.txt"
Remember to substitute the <sql_server_name>
placeholder for your SQL server name.
In this example, we are using the following parameters:
-s
specifies the SQL server for the new database.-a
sets the password for the administrator account.-d
names the database in your SQL Server.--license-file
specifies the path to a text file containing your license key.
Run dotnet kentico-xperience-dbmanager -- --help
to see the complete list of available commands.
For more details about parameters and configuration options, visit our documentation.
That’s it for the installation process. You now have a basic project with a database on your machine.
Set up local hosting
When developing websites, you often need to build and test code changes quickly. 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. Kestrel is cross-platform and comes included by default with .NET installations. To launch the installed website, execute the following command in the ~/src/Kickstart.Web directory:
dotnet run
Alternatively, you may be able to run the dotnet run
command directly from your IDE.
You should see output similar to the following in the terminal:
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:33328
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 (in our case, http://localhost:33328) to view your site.
When the site loads, you should see a message that says something like this:
The Kickstart.Web site has not been configured yet.
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 ‘kickstart’, as you specified when installing the project database.
Useful resources for your reference
Take a look at Administration interface basics – a short overview of the Xperience administration and its common navigation and interaction patterns.
Watch this video for a quick walkthrough on installing Xperience by Kentico.
Check out our Install a specific version of Xperience by Kentico guide to learn how to manage different Xperience template versions on your machine.
Explore the Xperience Manager tool, which can help you simplify installing and managing Xperience by Kentico instances in future projects.
Now, let’s continue with the next step, where you will learn how to create a reusable content type, an essential building block in developing multichannel experiences with Xperience by Kentico.
Previous step: Xperience by Kentico overview — Next step: Create a reusable content type
Completed steps: 2 of 13