---
title: Deploy without the administration
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

> **Note:** Deployment without the Xperience by Kentico administration is currently not supported when [deploying to SaaS](https://docs.kentico.com/documentation/developers-and-admins/deployment/deploy-to-the-saas-environment.md). The scenario described on this page applies only to [private cloud deployments](https://docs.kentico.com/documentation/developers-and-admins/deployment/deploy-to-private-cloud.md).

Xperience and all related dependencies are installed via [NuGet packages](https://docs.kentico.com/documentation/developers-and-admins/development/website-development-basics/configure-new-projects/xperience-by-kentico-nuget-packages.md). The installed packages dictate the features available to each project. However, not all packages are required for Xperience sites to run in production environments.

The Xperience administration interface (installed via the **Kentico.Xperience.Admin** NuGet package) and all related customizations can be removed when publishing to production. In these types of environments, you can have:

- One Xperience instance **with** the administration interface. Access to this instance is restricted only to authorized users (i.e., placed behind a firewall or on a private network). This is where content editors and other users work with the system.
  - **Note**: Do not remove any code that is part of your project's live site implementation or presentation logic (controllers, views, etc.) from the administration instance. Even though the instance is not intended for live visitors, such logic is required by certain administration features, such as the [preview mode](https://docs.kentico.com/documentation/business-users/website-content.md#preview) for website channel pages.
- Another Xperience instance **without** the administration interface. This is the instance with which regular live site visitors interact.
- Both instances [connect to the same database](https://docs.kentico.com/documentation/developers-and-admins/configuration/auto-scaling-support.md).

| Advantages                  | **Increased security** – removing the administration from public-facing sites reduces the attack surface available to malicious actors.<br>**Improved performance** – removing the administration reduces application overhead, which is beneficial for sites with significant traffic. For example, the administration registers a separate middleware pipeline for user authentication, which is unnecessary for the live site.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Disadvantages               | **Deployment complexity** – preparing a separate instance without the administration and its dependencies increases the complexity of your environment and adds extra steps to your deployment process.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Limitations and workarounds | **Admin UI Icon class** – your project's implementation may use the `Kentico.Xperience.Admin.Base.Icons` class to set icons when registering components, such as [Page Builder templates](https://docs.kentico.com/documentation/developers-and-admins/development/builders/page-builder/page-templates-for-page-builder.md), [Email Builder templates](https://docs.kentico.com/documentation/developers-and-admins/development/builders/email-builder/develop-email-builder-components.md#templates), or [custom automation steps](https://docs.kentico.com/documentation/developers-and-admins/digital-marketing-setup/automation-customization/automation-custom-steps.md). While these components must remain in the live site project, the `Icons` class is not available without the Xperience administration packages. To resolve this, replace usages of the class with the corresponding icon class string values. You can define your own constants for these strings if you wish to avoid hard-coded values. |

In the most basic scenario, you can set up and deploy Xperience without the administration manually:

1. Create a separate copy of your Xperience application.
2. Uninstall the **Kentico.Xperience.Admin** NuGet package and remove any custom code intended only for the administration.
3. Deploy both applications – the original to an environment with restricted access and the new copy without the administration to production.

However, in most cases, we recommend that you integrate the separation into an automated publishing script or pipeline.

## Sample automated separation process

This section outlines an approach that modifies the application's build process to remove the **Kentico.Xperience.Admin** NuGet package and all related dependencies, including custom code intended only for the administration. The demonstrated approach is suitable for use in publishing scripts or automation pipelines.

1. Edit your Xperience application's .csproj file and add a new `AdminAttached` [MSBuild property](https://docs.microsoft.com/en-us/visualstudio/msbuild/propertygroup-element-msbuild):

   ```xml title="Xperience application's .csproj file"
   <PropertyGroup>
       <TargetFramework> <!-- ... --> </TargetFramework>
       <RootNamespace> <!-- ... --> </RootNamespace>
       <!-- Defines an MSBuild property that defaults to true 
            if not explicitly passed to MSBuild as a parameter -->
       <AdminAttached Condition="'$(AdminAttached)' == ''">true</AdminAttached>  
   </PropertyGroup>
   ```
2. Add the following condition to the `Kentico.Xperience.AspNetCore.Admin` package reference using the `Condition` attribute:

   ```xml title="Xperience application's .csproj file"
   <ItemGroup>
       ...
       <!-- If the specified condition evaluates to true (true by default), the project maintains this package reference -->
       <PackageReference Include="kentico.xperience.admin" Version="..." Condition="'$(AdminAttached)' == 'true'" />
   </ItemGroup>
   ```
3. Follow a similar process to remove any custom code when [customizing the administration interface](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface.md) or some of its [components](https://docs.kentico.com/documentation/developers-and-admins/configuration/rich-text-editor-configuration/rich-text-editor-customization.md). Assuming your code follows best practices for admin UI customization outlined in [Admin UI customization model overview](https://docs.kentico.com/documentation/developers-and-admins/customization/extend-the-administration-interface/admin-ui-customization-model-overview.md), your administration-related code is located in isolated assemblies/NuGet packages, making the process straightforward. Repeatedly add the `Condition` attribute to all relevant references:

   ```xml title="Xperience application's .csproj file"
   <!-- Project assembly references -->
   <ItemGroup>
       ...
       <ProjectReference Include="..\Acme.Web.AdminCustomCode.csproj" Condition="'$(AdminAttached)' == 'true'" />
   </ItemGroup>  

   <!-- Project package references -->
   <ItemGroup>
       ...
       <PackageReference Include="Emca.Web.AdminCustomCode" Version="..." Condition="'$(AdminAttached)' == 'true'" />
   </ItemGroup>
   ```

   > **Info:** If you also need to make specific code outside dedicated assemblies run only when the administration is attached, declare a conditional compilation constant and use it as required:
   >
   > ```xml title="Xperience application's .csproj file"
   > <PropertyGroup Condition="'$(AdminAttached)' == 'true'">
   >     <DefineConstants>$(DefineConstants);ADMIN_ATTACHED</DefineConstants>
   > </PropertyGroup>
   > ```
   >
   > ```csharp title="ADMIN_ATTACHED usage"
   > #if ADMIN_ATTACHED
   >     // Surrounded code only compiles when administration dependencies are present
   > #endif
   > ```
   >
   > You can also invert this condition to run code only when the administration is detached. However, **do not** use such conditions to remove your project's live site implementation or presentation logic from the administration instance. Such logic is required by certain administration features, such as the [preview mode](https://docs.kentico.com/documentation/business-users/website-content.md#preview) for website channel pages.
4. When you need to publish the project without admin UI packages and dependencies, pass `AdminAttached=false` as a parameter to MSBuild:

   ```cmd
   dotnet publish -c Release -p:AdminAttached=false --output <OUTPUT_DIRECTORY>
   ```

The output directory now contains the published application minus the dependencies marked by the `AdminAttached` condition.
