---
title: Creating installation packages for modules
related:
  - https://docs.kentico.com/k82/custom-development/creating-custom-modules/creating-installation-packages-for-modules/example-creating-a-packageable-module.md
  - https://docs.kentico.com/k82/custom-development/creating-custom-modules/creating-installation-packages-for-modules/installing-modules-from-installation-packages.md
---

> 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).

The system allows you to transfer custom modules to other instances of Kentico using [NuGet packages](https://www.nuget.org/).

When creating modules that you wish to deploy as installation packages, you need to take additional steps during the development process. The module must be represented by a separate web application project inside the Kentico solution. Based on [conventions](#reference---custom-module-conventions), the installation package automatically includes files from specific folders and database objects related to the module.

The module project only exists on the Kentico instance that you use to develop the module. When you [install the module](https://docs.kentico.com/k82/custom-development/creating-custom-modules/creating-installation-packages-for-modules/installing-modules-from-installation-packages.md) on a different instance, all code (including code behinds of web forms and controls) is compiled inside the module DLL, and other files are integrated into the main Kentico project. Installation of modules is supported for both _web application_ and _web site_ type projects.

Module packages do not include any data stored in module classes. If you wish to provide default data along with your module, you can prepare additional [export packages](https://docs.kentico.com/k82/deploying-websites/exporting-and-importing-sites/exporting-objects.md) containing the data or an [SQL script](#preparing-additional-sql-scripts-for-the-installation) that creates the required data after the installation of the module.

> **Info:** **Limitations**
>
> Modules transferred via installation packages _currently_ have the following limitations:
>
> - To install module packages, you need to open the target project in Visual Studio – the installation cannot be performed on certain types of deployed and running websites (for example on Microsoft Azure).
> - You cannot use installation packages to transfer modules for development on other instances – the module always becomes sealed and uncustomizable after installation, and all code is compiled into a DLL. If you wish to develop the module on multiple instances, you need to manually transfer the module's files and database objects.
> - The system has very limited support for uninstalling or updating modules installed from packages.
> - You cannot define dependencies between multiple module packages.
> - You cannot easily use components (user controls etc.) from the main Kentico project inside the module's project. This may make it difficult to develop custom web forms, user controls or web parts within packageable modules.
> - If you transfer a web part with a [custom layout](https://docs.kentico.com/k82/custom-development/developing-web-parts/using-custom-web-part-layouts.md) as part of the module, the layout does not work correctly when [Deployment mode](https://docs.kentico.com/k82/deploying-websites/deployment-mode-for-virtual-objects.md) is enabled.
> - You cannot create installation packages for:
>
>   - The default Kentico modules.
>   - The default _Custom_ module, which is intended for non-transferable customizations.
>   - Modules installed from other installation packages.

**To create an installation package for a custom module, you need to**:

1. [Create a separate project for the module in the Kentico solution](#creating-the-module-project)
2. Develop the module (see [Example - Creating a packageable module](https://docs.kentico.com/k82/custom-development/creating-custom-modules/creating-installation-packages-for-modules/example-creating-a-packageable-module.md) for an example)
3. [Make sure the installation package includes database objects related to the module](#including-database-objects-in-the-package)
4. Optional steps:
   - [Add additional libraries to the module installation package](#adding-additional-libraries-to-the-package)
   - [Configure the module's custom settings](#configuring-custom-module-settings)
   - [Prepare additional SQL scripts for the module installation](#preparing-additional-sql-scripts-for-the-installation)
5. [Create the module installation package](#creating-the-module-installation-package)

## Creating the module project

> **Note:** We strongly recommend using _web application_ installations of Kentico when developing custom modules that you wish to deploy as installation packages.
>
> Module projects always use the [web application format](http://msdn.microsoft.com/en-us/library/dd547590.aspx) – having the same project type for the main Kentico project makes it easier to reuse files. With _web site_ projects, you need to manually ensure that all module files are converted to the web application format.

Before you can develop a module that supports the creation of installation packages, you need to prepare a web application project and include this project in the Kentico solution.

The following steps are necessary to maintain the proper folder structure within the Kentico solution:

1. [Create the project](#creating-the-project)
2. [Copy the project files to the Kentico solution](#copying-the-project-files-to-the-kentico-solution)
3. [Include the project in the Kentico solution](#including-the-project-in-the-kentico-solution)

### Creating the project

1. Open Visual Studio and create a new web application project.
   - **Important**: The project name must match the module's code name.
   - Select the **ASP.NET Empty Web Application** project template (in Visual Studio 2013, available in the **Visual C# -> Web -> Visual Studio 2012** template category).
2. Delete the project's _Web.config_ file.
3. In the project's **Properties** folder, rename the _AssemblyInfo.cs_ file to _\<project name>AssemblyInfo.cs_.
4. Save the project.

### Copying the project files to the Kentico solution

1. Open the project's folder on your file system.
2. Edit the _\<project name>.csproj_ file and make sure the content reflects the change in the name of the _AssemblyInfo.cs_ file.

   ```xml

   <Compile Include="Properties\<project name>AssemblyInfo.cs" />

   ```
3. Copy the _**\<project name>.csproj**_ file to the **CMS** folder of your Kentico web project.
4. Copy _**\<project name>AssemblyInfo.cs**_ from the project's **Properties** directory to the **CMS\Properties** folder of your Kentico web project.

### Including the project in the Kentico solution

1. Open your Kentico solution in Visual Studio (using the _WebApp.sln_ file).
2. Add your custom module project to the Kentico solution:

   1. In the Solution Explorer, right-click the solution.
   2. Click **Add -> Existing Project...**
   3. Select the _\<project name>.csproj_ file in the project's **CMS** folder.
3. Add the required references to your custom module project:

   1. Right-click the project and select **Add -> Reference**.
   2. Open the **Browse** tab of the **Reference manager** dialog, click **Browse** and navigate to the _**Lib**_ folder of your Kentico web project.
   3. Add a reference to the _**CMS.Core.dll**_ library (and any others that you require for custom code).
4. Expand the **Properties** folder of the module project and edit _**\<project name>AssemblyInfo.cs**_.
5. Add the **AssemblyDiscoverable** assembly attribute:

   ```csharp

   using CMS;

   [assembly:AssemblyDiscoverable]

   ```
6. Save the solution and all files.

The Kentico solution now contains a web application project representing your custom module. You can start developing the module. After you compile the module code into an assembly (i.e. build the project), the system automatically includes the resulting DLL when you create an installation package for the module.

The additional project only exists on the Kentico instance that you use to develop the module. When you [install the module](https://docs.kentico.com/k82/custom-development/creating-custom-modules/creating-installation-packages-for-modules/installing-modules-from-installation-packages.md) on a different instance, all code is already compiled inside the module's DLL and other files are integrated into the main Kentico project.

> **Info:** **Note**: If you ever need to rename a module during development, **Clean** your solution in Visual Studio **before** you rename the module project or manually delete the original DLL. Otherwise the module's old DLL may cause errors on your site.

## Including database objects in the package

When [creating](#creating-the-module-installation-package) module installation packages, the system automatically includes the following database objects that are directly related to the given module:

- Classes
- Permissions
- UI elements
- Setting categories and groups, including all contained setting keys

By following the [naming conventions](#conventions-for-database-objects), you can also create [Web parts](https://docs.kentico.com/k82/custom-development/developing-web-parts.md) and [Form controls](https://docs.kentico.com/k82/custom-development/developing-form-controls.md) that the system includes in the module's installation packages.

> **Note:** **Note**: Module installation packages cannot transfer other types of database objects, such as for example [scheduled tasks](https://docs.kentico.com/k82/configuring-kentico/scheduling-tasks.md). You can create separate [export packages](https://docs.kentico.com/k82/deploying-websites/exporting-and-importing-sites/exporting-objects.md) for additional objects and deliver them together with your module's installation package.

## Adding additional libraries to the package

The system cannot automatically identify all dynamic link libraries (DLLs) required by your custom module. If your module uses third-party or custom libraries, you need to assign these libraries to the module before creating the installation package.

1. Open the **Modules** application and **Edit** () your custom module.
2. Switch to the **Additional libraries** tab.
3. Assign any number of libraries from the project's **bin** folder:

   1. Click **Add library**.
   2. Select the library that you wish to include in the module's installation package.
   3. Click **Select**.

When you create the module installation package, the package also contains the selected libraries.

**Note**: Do NOT assign DLLs that are part of the default Kentico project as additional libraries of module packages. This includes any DLL files in the _CMS\bin_ or _CMS\CMSDependencies_ folders of unmodified Kentico projects. Adding these libraries may cause the system to work incorrectly after installing the custom module package.

## Configuring custom module settings

If you have defined [custom settings](https://docs.kentico.com/k82/custom-development/creating-custom-modules/adding-custom-website-settings.md) for the module, we recommend configuring the default values of the settings before you create the installation package. Open the **Settings** application and set the desired _(global)_ values for the module's settings.

The setting values configured on the development instance are used by default when the module is installed on other instances of Kentico.

## Preparing additional SQL scripts for the installation

Installation packages cannot automatically transfer certain types of database components, such as **indexes** and **views**. If you wish to deliver such components with the module, you need to manually prepare SQL scripts that create the required database objects.

Add the script files into the development project's _\~/App\_Data/CMSModules/\<module code name>/Install/_ folder (create the folder if necessary). The script files must be named either **before.sql** or **after.sql** (intended to run before or after importing the module's database objects respectively).

The system automatically includes the script files into the module's installation packages. When [installing the module](https://docs.kentico.com/k82/custom-development/creating-custom-modules/creating-installation-packages-for-modules/installing-modules-from-installation-packages.md), users need to run the _before.sql_ and _after.sql_ scripts against their database.

## Creating the module installation package

Once your custom module is fully developed, you can create the installation package in the Kentico administration interface:

1. Open the **Modules** application and **Edit** () your custom module.
2. On the **General** tab, fill in the module's metadata:

   - **Module description** (Default value: _No description provided_)
   - **Module version** (Default value: _1.0.0_)
   - **Module author** (Default value: _Unknown_)

     > **Info:** The system saves the values into the metadata of the module's installation packages. If not specified, the package contains the default values.
3. Click **Save**.
4. Click **Create installation package**.
   - The system opens a dialog showing the package's metadata, and the files and objects included in the package.
5. Click **Create**.

The system creates the module installation package in the project's export folder (**CMS\CMSSiteUtils\Export** by default). You can use the package to [install](https://docs.kentico.com/k82/custom-development/creating-custom-modules/creating-installation-packages-for-modules/installing-modules-from-installation-packages.md) the module on other instances of Kentico.

> **Note:** **Kentico version requirements of module packages**
>
> Module packages can be successfully installed only on Kentico instances that have the same version as the source instance, including minor hotfix versions. For example, if you create a module installation package on a 8.2.16 instance, users cannot install the package on Kentico 8.2.15 or older. We strongly recommend adding information about the minimum required Kentico version into the _**Module description**_.
>
> Module packages from older versions can be installed on newer versions, but may cause problems or errors depending on the differences in the data structure and API of the two versions.

## Reference - Custom module conventions

To ensure that the installation packages created for your custom modules contain the required files and database objects, you need to follow naming and location conventions.

- [File system conventions](#file-system-conventions)
- [Conventions for database objects](#conventions-for-database-objects)

> **Info:** **Module code name**
>
> The naming conventions for folders, files and database objects are based on the **Module code name**, including any prefixes or namespaces. For example: _Acme.Forums_
>
> Carefully consider the code name when creating custom modules. Choose a _**sufficiently unique**_ module code name to avoid collisions with the default Kentico modules or other custom modules. Do NOT start the code names of custom modules with the **cms.** prefix, which is reserved for Kentico modules.

### File system conventions

> **Note:** **Important**
>
> Include all custom files related to your module into the module's web application project in Visual Studio, NOT the default Kentico web project (_CMSApp_).
>
> Both projects share the same folder on the file system, so you can include files located in the default Kentico folders (such as _\~/App\_Data/CMSModules_ or _\~/CMSWebParts_) without problems. When the module package is installed on a different instance, files from both projects are merged into the standard Kentico project.
>
> Including files in the module project ensures that:
>
> - Custom module files are clearly separated in your development solution from the default files.
> - All required code is compiled into the module's DLL. Module installation packages transfer all code within the module DLL, without the original code files. Files with separate code behinds (web forms, user controls, web parts, form controls, handlers, etc.) are installed without the code behind and instead reference the appropriate class in the module DLL.

| Module component       | Convention                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Module library         | The library containing the module's compiled code must be located in the _\~/bin_ folder of the Kentico project and have the same name as the module code name. For example, the _Acme.Forums_ module has the _Acme.Forums.dll_ library.<br>As long as the module's web application project in the Kentico solution matches the module name, the library is created automatically when you compile the project.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 3rd party libraries    | You can [manually include 3rd party libraries](#adding-additional-libraries-to-the-package) into the module's installation package using the administration interface. The libraries must be located in the _\~/bin_ folder of the Kentico project.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Code files             | All code files must be included in the module's web application project in Visual Studio. Examples of module code files are:<br>_Info_ and _InfoProvider_ files of the module's classes<br>The file containing the module's [initialization code](https://docs.kentico.com/k82/custom-development/creating-custom-modules/initializing-modules-to-run-custom-code.md)<br>[User interface extenders](https://docs.kentico.com/k82/custom-development/creating-custom-modules/creating-extenders-for-module-interface-pages.md)<br>We recommend organizing the code files inside a folder that matches the code name of the module, for example: _\~/Acme.Forums/_                                                                                                                                                                                                                                                                                                                                                                    |
| Web forms and controls | Place web forms or user controls used by your module into the **_\~/CMSModules/_\<module code name>_/_** folder.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Web part files         | Place the source files (user controls) of [web parts](https://docs.kentico.com/k82/custom-development/developing-web-parts.md) that are part of your module into the _**\~/CMSWebParts/\<module code name>/**_ folder.<br>For example: \~/CMSWebParts/Acme.Forums/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Form control files     | Place the source files (user controls) of [form controls](https://docs.kentico.com/k82/custom-development/developing-form-controls.md) that are part of your module into the _**\~/CMSFormControls/\<module code name>/**_ folder.<br>For example: _\~/CMSFormControls/Acme.Forums/_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| UniGrid definitions    | Place the XML definitions for the module's [UniGrid](https://docs.kentico.com/k82/references/kentico-controls/ui-controls/unigrid.md) components (object listings) into the _**\~/App\_Data/CMSModules/\<module code name>/UI/Grids/**_ folder.<br>The default recommended location includes further subfolders named after specific object types. For example: \~/App\_Data/CMSModules/Acme.Forums/UI/Grids/Acme\_Forums\_Forum/default.xml                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Resource strings       | Place the module's [resource strings](https://docs.kentico.com/k82/multilingual-websites/setting-up-a-multilingual-user-interface/working-with-resource-strings.md) into _resource files (.resx)_ inside the _**\~/CMSResources/\<module code name>/**_ folder. To add resource files for specific languages, create subfolders with names that match the required _culture code_.<br>For example, _\~/CMSResources/Acme.Forums/Common.resx_ for strings in the default culture, and _\~/CMSResources/Acme.Forums/\<language code>/Common.resx_ for the _\<culture code>_ culture.<br>Note: If you plan to [publish](https://docs.kentico.com/k82/deploying-websites/publishing-projects-from-visual-studio.md) your development project, set the [Build Action](https://msdn.microsoft.com/en-us/library/0c6xyb66%28v=vs.100%29.aspx) property of resource files to **Content** to ensure that they are included. The Build Action of resx files must also be set manually on other instances after installing the module package. |
| JavaScript files       | If your module uses JavaScript files, place them into the _**\~/CMSScripts/CMSModules/\<module code name>/**_ folder.<br>For example: _\~/CMSScripts/CMSModules/Acme.Forums/TextBox.js_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| CSS                    | If your module uses physical CSS files, place them into the _**\~/CMSModules/\<module code name>/Content/**_ folder.<br>For example: _\~/CMSModules/\<module code name>/Content/Forums.css_<br>To add links to module stylesheets on pages, call the following methods (in the code behind of pages or components such as form controls):<br>_CSSHelper.RegisterModuleStylesheets_ - adds links for all stylesheets of the specified module.<br>_CSSHelper.RegisterModuleStylesheet_ - adds a link for one particular module stylesheet.<br>The _CSSHelper_ class requires a reference to the _CMS.Helpers_ namespace.                                                                                                                                                                                                                                                                                                                                                                                                              |
| HTTP handlers          | If your module uses HTTP handlers or other types of system pages, place them into the **_\~/CMSModules/_\<module code name>_/CMSPages/_** folder.<br>For example: _\~/CMSModules/Acme.Forums/CMSPages/GetAttachmentHandler.ashx_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

### Conventions for database objects

| Object type                                                                                 | Convention                                                                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Web part](https://docs.kentico.com/k82/custom-development/developing-web-parts.md)         | The code names of web parts must start with the _**\<module code name>.**_ prefix (including the dot character).<br>For example: \*\*_Acme.Forums._ForumList__<br>Module installation packages automatically include the parent categories of web parts that match the naming convention. |
| [Form control](https://docs.kentico.com/k82/custom-development/developing-form-controls.md) | The code names of form controls must start with the _**\<module code name>.**_ prefix (including the dot character).<br>For example: _Acme.Forums.TextBox_                                                                                                                                |
