5 MONTHS AGO

Help: My custom module classes are not being imported in Kentico

The other day a colleague panicked when his custom module was only partially imported on his co-workers machines. The custom classes were not part of the export package, and he could not figure out what the issue was. While I had encountered this once before, I simply forgot how to fix it. With this post I hope to add the resolution to my long term memory, and ofcourse help everyone who is facing the same issue ;)

The cause of the issue actually contradicts the title of this post. The classes are not being imported because they are not part of the export package. This can be easily identified by opening the export package and looking for the cms_class.xml.export:

Custom modules classes missing in export packages

The misleading part of the whole process is that during the creation of the export package, the progress window shows that it exported the classes (while that obviously is not the case):

Exporting Classes in Export progress

With this info it's kindof hard to "guess" what went wrong. To keep a long story short, the issue was caused because the custom module was sealed on the Kentico instance where the export package of the custom module was created. If you create export packages of sealed modules, Kentico will not add the class definition to the export packages.

The best practise is to create unsealed export packages of custom modules during development. Don't forget to uncheck the "Seal the selected modules" when selecting the module object in the export wizard:

Uncheck seal the selected modules

This will ensure that the class definition will be added to the export package:

Class exists in export packages

And remember that it will only work if your custom module is not sealed in the first place! If you come across a sealed module, I recommend reading the blog post of David te Kloese (Kentico MVP): 'Unseal' your custom installed modules

Hope this helps!