Try our conversational search powered by Generative AI!

How to create add-on for CMS 12?


Can someone please point me in the right direction on how to create an add-on (dojo module) for CMS 12?
This documentaion is not yet updated for CMS 12:

Oct 06, 2021 13:12

Erik, the dojo part hasn't changed. It's just that we no longer have web.config nad you need to add your custom module.

Example of adding a protected module:

    pm =>
        if (!pm.Items.Any(i =>
            i.Name.Equals("episerver-labs-content-manager", System.StringComparison.OrdinalIgnoreCase)))
            pm.Items.Add(new ModuleDetails() { Name = "episerver-labs-content-manager" });

module.config format has not changed significantly (there are a few additional properties like the type of json serializer type or default authorization)

Edited, Oct 12, 2021 12:08

Thanks Bartosz! How to register the module was the missing piece I needed. This page helped me


Oct 12, 2021 12:22

The dojo add-on is working fine in CMS 12. But I have trouble with packing the add-on in a nuget.
Apparently content files are handled a bit differently in .net5/core projects. They are not copied to the project directory. They are included in the project, but the files reside in the nuget package location.
It seems that the dojo module requires the files to physically be in the project directory (modules/_protected/mymodule/, otherwise the js-files are not found.

A hacky way of moving the files to the project directory is to use msbuild to copy the files when the project is built (, but I can see several problems with that approach.

There must be a better way. Either to have the dojo module work with referenced files, or some clever nuget/nuspec way of doing it.
How are the other nugets containing modules packed?

Oct 14, 2021 7:36

What we are doing is to specify in the nuspec file to add the zip file as a content file, like:

     <files include="any/any/modules/_protected/EPiServer.Cms.UI.Admin/" buildAction="None" copyToOutput="true"  />

The n when you run 'dotnet' publish it will put the zip files correctly (that is under folder /modules/_protected/ relative the root of your application.

Oct 15, 2021 7:15

We also have this hack with a target that copies the zip files from output to the root of the application:


<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="" ToolsVersion="4.0">
        <SourceScripts Include="$(MSBuildThisFileDirectory)..\..\contentFiles\any\any\modules\_protected\**\*.zip"/>

    <Target Name="CopyZipFiles" BeforeTargets="Build">

Then in the nuspec file:

   <files include="any/any/modules/_protected/EPiServer.Cms.TinyMce/" buildAction="None" copyToOutput="true"  />

And also in the nuspec file:

    <file src="src\EPiServer.Cms.TinyMce\license.txt" target="" />
    <file src="src\EPiServer.Cms.TinyMce\bin\$configuration$\EPiServer.Cms.TinyMce.dll" target="lib\net5.0" />
    <file src="src\EPiServer.Cms.TinyMce\bin\$configuration$\EPiServer.Cms.TinyMce.pdb" target="lib\net5.0" />
    <file src="out\" target="contentFiles\any\any\modules\_protected\EPiServer.Cms.TinyMce" />
    <file src="build\CopyZipFiles.targets" target="build\net5.0\Episerver.Cms.TinyMce.targets" />
Oct 15, 2021 10:52


If you are doing it, then I feel confident in doing it myself 😊.

I have spent way too much time on this... but this approach seems to be what people are doing.
My main issue is that the content file is not removed from the project directory when you uninstall the nuget.

Oct 15, 2021 13:20

@Bartosz Sekula you can get around also without nuspec file

Oct 20, 2021 7:20

Nice write-up Valdis. Thanks

Oct 20, 2021 13:16
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.