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

Introduction

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

Extensions

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 New GenericDNN Module with 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.

    • Open VS-2012 and create New Project
    • Select DotNetNuke C# Compiled Module from the list.

      DotNetNuke

    • Then, you will get a template for creating a Module, as shown below:

      template

    • The control flow will be:

      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.

  2. 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 as usual; will show error messages, will 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.

      Packages

      Packages
    • Before discussing about the debugging, let's discuss about installation.

      Step 1. Select Extensions from Host.

      Extensions

      Step 2. Click on Install Extension Wizard.

      Extensions

      Extensions

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

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

      module

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

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

      1. Install the module and add the module to a page.
      2. Open the website in VS and our project to the solution.
      3. Remove the reference from the website.
      4. Add project reference to the website .

Adding Existing Project

Adding

Adding Project Reference

Adding

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.

 
 

Up Next
    Ebook Download
    View all
    Learn
    View all