Creating installation package for module using standard Kentico form controls

UNRVLD Agency asked on May 4, 2017 06:40

Hi all

I need to create installation package for custom Kentico module. I created the package as per, so now I have separated web app project holding my custom functionality. Further I need to create custom form control that uses a Kentico form control (UniSelector), I created it in the module's web app and it looks like this

<%@ Control Language="C#" AutoEventWireup="true" Inherits="CMSModules_MyModule_Content_FormControls_Pages_SelectPage" Codebehind="SelectPage.ascx.cs" %>
<%@ Register src="~/CMSAdminControls/UI/UniSelector/UniSelector.ascx" tagname="UniSelector" tagprefix="cms" %>

<cms:UniSelector ID="pageSelector" runat="server" 
DisplayNameFormat="{%NodeAliasPath%} ({%DocumentName%})"
OrderBy="NodeLevel, NodeOrder"
AllowEmpty="True" />

.designer.cs file contains the following definition

protected global::CMSAdminControls_UI_UniSelector_UniSelector pageSelector;

The issue is that CMSAdminControls_UI_UniSelector_UniSelector type doesn't exist in module's web app assembly (it exists in the main CMSApp assembly), so module's project can't be built. I see two solutions:

  1. Include UniSelector.ascx (and all dependent ASCXes) in the module's project, but it may possibly lead to runtime error 'CMSAdminControls_UI_UniSelector_UniSelector type is ambigious', because the system will try to load it types from both CMSApp assembly, where it lives by default, and from the module's assembly. And I believe it is not a good way to exclude UniSelector from the CMSApp project.
  2. To reference CMSApp assembly in the module's project so that CMSAdminControls_UI_UniSelector_UniSelector type can be found there.

What is the proper solution? Is there any other one?

Recent Answers

Trevor Fayas answered on May 5, 2017 15:44

I would copy the uniselector control itself into your project and reference it as such, it's a control so i doubt it will be in the assembly files (i could be wrong though, you can try to see if some of the drivers in the LIB folder contain it).

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.