C#?
There's a misconception that DNN development is done in VB only. It's true that the DNN core is written in VB, but DotNetNuke is extended through the development of modules. Modules can be written in any .Net language, as long as they inherit from DotNetNuke.Entities.Modules.PortalModuleBase.
No more Private Assemblies
Private assemblies were used to decouple custom modules from the DNN core. New modules were developed in separate projects from DotNetNuke, and required a 'builder' project to assure the correct .dll's were being deployed to the correct \bin. My earlier DNN2 posts detailed the work required to hack up a good debugging DNN environment.
The new method of development and deployment takes advantage of ASP.Net's dynamic runtime compilation/code sharing features by placing source code inside the App_Code folder. Module interface & resource files are still inside of the \DesktopModules\[ModuleName] folder. Deployment now involves copying all the required (desktopmodule & app_code) files out and zipping them up with the [ModuleName].dnn manifest file.
For commercial module deployment (without the source), you need VS2005 Standard or better (VWD won't pre-compile your code), and you need to pre-compile your application
Templates
Install the Starter Kit for your VWD or VS2005 environment.
Download from www.dotnetnuke.com downloads section (must register first).
The Starter Kit installs templates for C# & VB modules.
Add New Module
1. Add Item
Select the web project (if you are opening the Source package, there will be many projects)
Ctrl+N (or File > New > File) to Add Item
Scroll down and select “DotNetNuke Module”
If you do not see this item, you either don't have the Starter Kit installed, or you didn't have the web project selected before this step.
Name your module - example, 'Test1' & Select your language, click 'Add'.
Note: View 'What did the template do?' below to see what just happened...
2. Update project folders - 2 folders were just created, and filled with the files needed for a new module.
Rename the folders 'ModuleName' to the name of your new Module in the following directories:
\App_Code
\DesktopModules
3. Update codeSubDirectories in web.config(not necessary for VB.Net Modules)
For ASP.Net 2 'runtime compilation' support, source code is kept in subdirectories within the App_Code folder.
Open web.config, for module named 'Test1', go to
<system.web><compilation ...><codeSubDirectories>, add the following element:
<add directoryName="Test1"/>
4. Install Both Module Definitions into DNN - 2 of the sql scripts created by the template must be executed within DNN.
Open DNN in your browser
Log in as host - default is login: host, pass: host
Go to SQL Page - In the nav, select Host > SQL
Execute SQL Scripts - these 2 files are inside the web project's DesktopModules folder. Follow the copy/paste/execute procedure below for each of these:
[ModuleName].SqlDataProvider, and
01.00.00.SqlDataProvider
Copy SQL to generate definitions - From Visual Studio, double-click on the file you are going to execute (there are 2, mentioned immediately above this line)
Ctrl+A, Ctrl+C to select all & copy to clipboard
Paste & Execute Script - Check 'Run As Script', and paste the script copied earlier into the textbox
Note: there's only a postback when this is done, no 'completed message or anything'.
Add New Module to Page
Click 'Home' on the nav. If you're logged in as host or admin, you will see the admin dialog along the top of the page.
In the center of the admin dialog is the Module: dropdown box. Select your new module, and click 'Add' to the right.
Scroll down, you will see the new module, by default containing the test 'Here is some sample content.'
What did the template do?
The template just created 2 directories and a bunch of files for your module. All new modules are placed inside the ModuleName folders, due to limitations of Visual Studio templates. The stuff just added are all you need to start a new module, and includes:
SQL Script files
01.00.00.SqlDataProvider - Creates default table & CRUD sprocs
[ModuleName].SqlDataProvider - Registers module into DNN environment
Uninstall.SqlDataProvider - Cleans out db objects related to module
View/Edit/Settings Pages (actually controls)
Resources Directory & default files
Documents Directory & default files
Module Installation Manifest File
[ModuleName].dnn file is an xml file that describes the bits of the module. Parsed by DNN for easy deployment & automatic installation.
App_Code - The source code class files use the ASP.Net 2 App_Code solution for dynamic runtime compilation.
For more on the use of the App_Code directory, see:
Sharing Code Between Pages & Fritz Onion on Codebehind and Compilation in ASP.NET 2.0
Print | posted on Sunday, February 12, 2006 4:55 PM