DNN, Formerly DotNetNuke, Tutorial - Part Four (GenericDNN Modules)

Introduction

In this document, we are going to discuss how to create a new project that uses the template for GenericDNN modules. You may have seen a button named “Install Extension Wizard” in the Extensions menu while creating modules in DNN. See below.

Intsall extension wizard

Using this button, we can install new modules. From modules, I mean all SQL scripts, code, Module definitions, etc. We don’t need to configure the module from the module configuration page.

Create a new GenericDNN module with a template

  1. Copy the attached zip file named “DotNetNuke C_ Compiled Module.zip” to the following location (this will be the template for your module project).
    “C:\Users\....\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\Web” if you are using VS 2010.
    “C:\Users\.....\Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual Web Developer”, if you are using VS 2008.
  2. Open VS-2012 and create a New Project
  3. Select DotNetNuke C# Compiled Module from the list.
    Dot NET Nuke c sharp
  4. Then, you will get a template for creating a Module, as shown below.
    Reference
  5. The control flow will be.
    Control flow

The rest of the things I have already explained in the DNN (Formerly DotNetNuke) Tutorial - Part 3 (Create Custom Edit Page) article. Apply the same codes and designs here, but don’t forget to follow the pattern I have mentioned above.

Building, Debugging, and Installing the module

As we all know, we can build the solution either in Debug mode or in Release mode. Here, if we build the project in Debug mode it will behave like usual; will show error messages, create dll files, etc. As we are creating the installable module, we should build the project in Release mode.

When we build the project in Release mode,  the application will create a folder, “Packages”, in the root folder. It contains two zip files <project name><version>_Install and <project name><version>_Source.

Package

Packages

Before discussing the debugging, let's discuss the installation.

Step 1. Select Extensions from Host.

Extensions

Step 2. Click on Install Extension Wizard.

Install extension wizard

Upload new extension package

Step 3. Choose <project name><version>_Install the file from the packages folder, from the popup page.

Step 4. Follow the instructions given by DotnetNuke. After successful installation, your module will be listed in the modules list.

moduleModules

To use the module on your page, please refer to the article DNN (Formerly DotNetNuke) Tutorial - Part 2 (Adding Modules).

We cannot debug/test our module without installing it on a website. To debug/test the functionality, follow the below steps.

Install the module and add the module to a page

Open the website in VS and our project to the solution.

Remove the reference from the website.

Add a project reference to the website.

Adding Existing Project

Add

Adding project reference

Project

Conclusion

If our module is a generic one, we can follow this way to create a module. The main advantage of this method is that anyone can install the module without any help from a developer. Please try this and let me know if you’re facing any issues.