Kentico: Installing the connector

In this article you’ll find:

Goal

This article provides information on how to install the connector to a Kentico project.

Prerequisite

  1. The backend website must be on Kentico 13 for NuGet version 13.x.x or at least Kentico 12.0.29 for the version 12.x.x NuGet.

  2. The frontend website needs to be an ASP .NET Core MVC for the version 13.x.x NuGet or an ASP .NET Web Application for the version 12.x.x NuGet.

  3. Corresponding version of Kentico connector NuGet package:

    • Install from the following NuGet repository - https://developer.hawksearch.com/nuget

    • Install the NuGet from local repository - Place the NuGet package in a local folder on your workstation and set it as Package source in Visual Studio

    • Kentico 13 - NuGet version 13.x.x

    • Kentico 12 - NuGet version 12.x.x

Steps to install the connector

Live frontend project

Kentico 13

  1. Install the Hawksearch.Kentico.Xperience.UI NuGet package.

  2. In the startup ConfigureServices method, add the “AddHawksearchConnector()” extension method on the result of “AddControllersWithViews()”.

  3. In the same method, add a call to “AddHawksearchViews()” to the IServiceCollection.

  4. In the Configure method, add a call to “UseHawksearchConnector()“ on the IApplicationBuilder.

  5. In your layout file, there are a few things that need to be added.

    <!DOCTYPE html> @{ var settings = CMS.Core.Service.Resolve<Hawksearch.Kentico.Xperience.CMS.Configuration.IConnectorSettingsProvider>().GetSettings(); } <html> <head> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> <page-builder-styles /> @if (settings.FrontendFramework == Hawksearch.Kentico.Xperience.CMS.Configuration.FrontendFrameworkType.React) { <link rel="stylesheet" href="/assets/hawksearch/react/dist/main.css" /> } </head> <body> <div> @RenderBody() </div> <page-builder-scripts /> @if (settings.FrontendFramework == Hawksearch.Kentico.Xperience.CMS.Configuration.FrontendFrameworkType.Vue) { <script src="/assets/hawksearch/vue/dist/main.js"></script> } else { <script src="/assets/hawksearch/react/dist/main.js"></script> } </body> </html>
  6. Rebuild your solution.

The namespace for all the extension methods is Hawksearch.Kentico.Xperience.Configuration.

ConfigureServices method:

services.AddControllersWithViews().AddHawksearchConnector();

Configure method:

app.UseHawksearchConnector();

Kentico 12

  1. Install the Hawksearch.Kentico.Xperience.UI NuGet package.

  2. In your main web.config file, add the following lines:

  3. In your layout file, there are a few things that need to be added.

Backend CMSApp project

 

  1. Install the Hawksearch.Kentico.Xperience.CMS NuGet package.

  2. Rebuild your solution.

Run the CMSApp project and make sure at least one request passes through. Kentico will automatically install all required objects in the database.

Next steps