Hide menu Last updated: Jul 09 2014

This is a pseudocode description of the element structure of the module.config file. Refer to the Configuration section for an explanation of the syntax used in the description of the configuration elements.

Each element name below is also a link leading to the detailed information for that element.

The module.config file is located in the root directory of a shell module and contains settings specific to that module.

<module>
        <assemblies/>
        <routes/>
        <clientResources/>
        <dojo/>
        <clientModule/>
</module>

<module>

XML
<module helpFile="string"
        productName="string"
        clientResourceRelativePath="string"
        type="string" 
        loadFromBin="string">
        <a href="#assemblies"><assemblies/></a>
        <a href="#routes"><routes/></a>
        <a href="#clientResources"><clientResources/></a>
        <a href="#dojo"><dojo/></a>
        <a href="#client"><clientModule/></a>
</module>

<module> Element Attributes

NameDefault ValueDescription
helpFile   URL to the help file for this module. {culture}, {major}, {minor}, {build}, {revision} are replaced.
productName   A product name for display. If this is not specified the module name is used.
clientResourceRelativePath   The client module resource relative path is combined with the resource base path and is used for paths to client resources specifically. If not defined the resource base path is used as-is. One use for this is versioning the client resources in a module.
type   The type specifies which class to instantiate for this module instance. If this is not set ShellModule is used.
loadFromBin true Whether to load all assemblies from the bin folder of the module. Otherwise only assemblies listed under the assemblies element are loaded.

<assemblies>

This list of assemblies specifies which assemblies belong to this shell module.

XML
<assemblies>
      <add assembly="string" />
      ...
</assemblies>

<add> Element Attributes

NameDefault ValueDescription
assembly   Required. The name of an assembly that should be loaded and associated with the module.

<routes>

XML
<routes>
    <route url="string"
           clientSideOnly="string"
           type="string"
           controllerPrefix="string">
      <defaults>
        <add key="string"
             value="string" />
        ...
      </defaults>
      <constraints>
        <add key="string"
             value="string" />
        ...
      </constraints>
      <dataTokens>
        <add key="string"
             value="string" />
        ...
      </dataTokens>
    </route>
    ...
</routes>

<route> Element Attributes

NameDefault ValueDescription
url {moduleArea}/{controller}/{action}/{id} The URL pattern for the route. See the Route.Url property for details on how these values are used by the ASP.NET routing system. URL parameters are enclosed in braces ({}).
clientSideOnly false Determines whether this route only affects the client routing model.
type   Fully qualified name of class to instantiate for routing instead of Route. The class must inherit RouteBase.
controllerPrefix   A prefix applied to to all controllers routed to this route. This makes it possible to "scope" controllers so they don't conflict with application controllers.

<defaults>/<add> Element Attributes

These values specify the default values used when URL parameters (see the url attribute on the route element) are not defined in the request. See the Route.Defaults property for details on how these values are used by the ASP.NET routing system.

NameDefault ValueDescription
key   Required. Parameter name
value   Required. Default value for this parameter

<constraints>/<add> Element Attributes

These constraints limit which values are accepted as valid values for URL parameters (see the url attribute on the route element). See the Route.Constraints property for details on how these values are used by the ASP.NET routing system.

NameDefault ValueDescription
key   Required. Parameter name
value   Required. Regex which matches allowed values for this parameter

<dataTokens>/<add> Element Attributes

Data tokens are custom values that are passed to the route handler, but which are not used to determine whether the route matches a URL pattern. See the Route.DataTokens property for details on how these values are used by the ASP.NET routing system.

NameDefault ValueDescription
key   Required. The name of the data token
value   Required. The value of the data token

<clientResources>

This section contains definitions of client resources that should be associated with the module.

XML
<clientResources>
    <add name="string"         
         path="string"         
         resourceType="string"
         sortIndex="int"
         isMinified="bool" >

        <dependencies>
            <add name="string" />
            ...
        </dependencies>
    </add>
    ...
</clientResources>

<add> Element Attributes

This is client resource definition.

NameDefault ValueDescription
name   Required. The name of the client resource. This is used as the key when loading resources. Several resources can share the same name if they should be grouped.
path   Required. The virtual path to the resource on this site or well-formed URL to external resource. If the virtual path is relative or partial it will be automatically resolved based on client resource base and relative paths of the module.
resourceType   Required. Specifies the type of the resource, must be one of "Script" or "Style".
sortIndex 0 The sort index can be used to specify dependencies between resources with the same name.
isMinified false Indicates whether the content of this client resource is already minified.

<dependencies>/<add> Element Attributes

The list of names of client resources that this resource depends on.

NameDefault ValueDescription
name   Required. The name of the client resource that this resource depends on.

<dojo>

This section contains configuration for paths and aliases used by dojo.

XML
<dojo>
    <paths>
        <add name="string" path="string" />
    </paths>
    <aliases>
        <add from="string" to="string" />
    </aliases>
</dojo>

<paths>/<add> Element Attributes

NameDefault ValueDescription
name   Required. Dojo module identifier fragment. (eg epi/cms)
path Scripts/[Name] Path to the module root.

<aliases>/<add> Element Attributes

Aliases allow module paths to be remapped at run time.

NameDefault ValueDescription
from   Required. Module path under dojo 1.7 (e.g. epi/cms/contentediting/editors/SelectionEditor).
to   Required. Module path under dojo 1.8 (e.g. epi-cms/contentediting/editors/SelectionEditor).

<clientModule>

This section contains client-side configuration options.

XML
<clientModule initializer="string">
    <moduleDependencies>
      <add dependency="string"/>
      ...
    </moduleDependencies>
    <requiredResources>
      <add name="string"/>
      ...
    </requiredResources>
    ...
</clientModule>

<clientModule> Element Attributes

NameDefault ValueDescription
initializer   The (javascript) class name which has the initializer for starting the module on the client.

Example of client-side initializer class

JavaScript
define(["dojo"], function(dojo) {
    return dojo.declare([], {
        initialize: function() {
            // Do any custom module initialization here
        }
    });
});

<moduleDependencies>/<add> Element Attributes

Defines shell modules that this module has a dependency on on the client side.

NameDefault ValueDescription
dependency   Name of shell module that this (client-side) module depends on.
type Require Type of dependency. The options are:
  • Require: This indicates that the named module needs to be started before this module.
  • RunAfter: This module will start automatically after the named module has started.
It is also possible to combine the above options.

<requiredResources>/<add> Element Attributes

This section defines which client resources should be loaded on the client.

NameDefault ValueDescription
name   The name of the client resource that is required and should be loaded. This refers to the name attribute in clientResources.

Application default module

In addition to the ordinary shell modules there is also a module configured for the application root. This module serves two main purposes; resolving paths to the application root when no matching module is found in the module system, and making it possible to let the application provide functionality which would otherwise require a separate module implementation.

This default module is always added to the module system as an empty module, and to configure it you have to place a module.config file in the application root. This module.config is then treated just as any other module configuration with the exception that the client resource base path is defaulted to ~/ClientResources, unless configured otherwise.

Example module manifest file

XML
<?xml version="1.0" encoding="utf-8" ?>
<module productName="Sample Module" clientResourceRelativePath="7.3.0" loadFromBin="false">

  <assemblies>
    <add assembly="Sample.UI" />
  </assemblies>

  <route controllerPrefix="Sample">
    <defaults>
      <add key="moduleArea" value="Sample.UI" />
      <add key="controller" value="Home" />
      <add key="action" value="Index" />
    </defaults>
  </route>

  <clientResources>
    <add name="sample.theme" path="ClientResources/sample.css" resourceType="Style" />
    <add name="sample.widgets" path="ClientResources/widget1.js" resourceType="Script">
      <dependencies>
        <add name="sample.dependency" />
      </dependencies>
    </add>
    <add name="sample.widgets" path="ClientResources/widget2.js" resourceType="Script" sortIndex="1" />
    <add name="sample.other" path="http://domain.com/Script.js" resourceType="Script" />
  </clientResources>

  <dojo>
    <paths>
      <add name="sample" path="ClientResources"/>
    </paths>
  </dojo>

  <clientModule>
    <moduleDependencies>
      <add dependency="Shell"/>
      <add dependency="Cms" type="RunAfter"/>
      <add dependency="AnotherAddon" type="Require RunAfter"/>
    </moduleDependencies>
    <requiredResources>
      <add name="sample.theme"/>
      <add name="sample.widgets"/>
    </requiredResources>
  </clientModule>
</module>

Comments