Visual Studio 2012 Project Template Introduction
This page contains information about the DotNetNuke Project Templates for Visual Studio 2012 found in the Visual Studio Gallery.
These templates are part of the ChristocTemplate.codeplex.com
project. You can download the source project from Codeplex if you want to modify the templates.
These templates utilize the MSBuild Community Tasks project, but you no longer need to download and install that project, they ship with the NUGET package for the project which installs it into the local directory when you create a new project.Update 1-24-2013
The 2.0 release of the ChristocTemplates project contains 4 total template, 2 for VB.NET and 2 for C#. There is a DAL (data access layer) and DAL2 (data access layer 2)
template for both languages. These templates are configured for DNN 7.0.2+
Template Descriptions (for v2.0)
- DotNetNuke 7 C# DAL2 Compiled Module - a DAL2 module template that comes preconfigured with functionality for creating, editing and deleting items. There are three controls, VIEW/EDIT/SETTINGS though the settings control is not used in the default functionality, it can easily be implemented with custom settings.
- DotNetNuke 7 C# Compiled Module - a standard DNN module with VIEW/EDIT/SETTINGS controls, and classes for the abstract and concrete data providers for the original DAL (data access layer)
- DotNetNuke 7 VB.Net DAL2 Compiled Module - a DAL2 module template that comes preconfigured with functionality for creating, editing and deleting items. There are three controls, VIEW/EDIT/SETTINGS though the settings control is not used in the default functionality, it can easily be implemented with custom settings.
- DotNetNuke 7 VB.Net Compiled Module - a standard DNN module with VIEW/EDIT/SETTINGS controls, and classes for the abstract and concrete data providers for the original DAL (data access layer)
How to Install the Visual Studio 2012 DotNetNuke Project Templates
Installation of the templates is pretty easy, there are multiple ways to do this, choose one of the three options below and perform the steps listed for the option you choose. You only need to do one of these options, not all three.
- Install using the Tools\Extensions and Updates menu in Visual Studio 2012 (will not work in Visual Studio Express editions)
- Mouse over the Tools menu
- Click on Extensions and Updates
- Search for DotNetNuke
- Choose the Install button for the DotNetNuke Project Templates option
- Install manually by downloading the VSIX file from the online gallery (should work in Visual Studio Express editions)
- Visit the Visual Studio Gallery – DotNetNuke Project Templates page
- Download the VSIX file via the Download link.
- Double click on the downloaded file to install the templates.
- Install manually by downloading from Codeplex (should work in Visual Studio Express editions)
- Download the VSIX file from Codeplex
- Double click on the downloaded file to install the templates.
Creating a DotNetNuke Module using the Templates
Once you’ve installed the templates, you can setup a project based on the templates. To do so you should follow the steps below
- (you should have this done already) Install Visual Studio 2012
- (you should have this done already) Install DotNetNuke Project Templates from the Visual Studio Gallery
- Setup your DotNetNuke Development environment following the steps listed here in the Wiki (the templates assume you have your development environment setup at http://dnndev.me/). Development Environment
- Run Visual Studio 2012 as an Administrator (right click on the shortcut to do so)
- File –> New Project
- Choose either C# or VB.Net from the Languages section of the new project dialog
- Select the DotNetNuke Folder under your preferred language (C# or Visual Basic)
- Choose either DotNetNuke C# Compiled Module or DotNetNuke 7 C# DAL2 Compiled Module template for your project template (or the VB.NET versions)
- For the new project creation screen using the following settings
- Name: ModuleName (something unique here, example DNNTaskManager)
- Location: c:\websites\dnndev.me\desktopmodules\ (this assumes you setup your development environment as instructed in Step 3)
- Solution: Create new solution
- Create directory for solution : Unchecked (this will cause path problems if checked, the templates assume the SLN is in the same folder as the project file)
- Add to source control: Unchecked (I typically get my project running before adding it to source control)
- Click OK
This will create a folder under c:\websites\dnndev.me\desktopmodules\ModuleName and should contain all of the files necessary for your module, including the Solution. There are a couple of next steps just to finalize the process, these steps are documented in the Documentation\Documentation.html file, which should open up automatically in Visual Studio after your project gets created, follow these steps to configure the final project properties, then you are ready to build/deploy your module. You can delete the documentation folder once you have completed those steps.
Build and Installation
To build and install your module, you should switch to Release mode in Visual Studio and then choose Build Solution from the Build menu. This will compile and package your module for distribution.
The module will be packaged into the INSTALL folder inside of desktopmodules\ModuleName. This is different a location from the prior version of my templates.
From there you can install the SOURCE package into the Host/Extension page of your development environment, that will install the module within DNN and allow you to place it on a page and start working with module. For more information check out the Task Manager tutorial series
How to Customize the Templates
You may want to customize these templates in order to define your own namespace, email address, and domain name for the project properties.
There are two ways to customize the templates, the first, modifying the ZIP files, is the recommended way.
Modify the ZIP files
- Download the ZIP file for the template that you want to modify, found at http://christoctemplate.codeplex.com
- Extract the ZIP file’s contents into a folder
- You might need to unblock the ZIP file first by right clicking on the file
- Choose properties
- Choose Unblock
- Edit the *.vstemplate file with a text editor
- Modify the Name of the template to something other than “DotNetNuke 7 VB.Net Compiled Module”, perhaps use your company name, “Christoc.com DNN7 VB.Net Compiled Module”
- Modify the CustomParameter values for
- rootnamespace – The namespace of your project, something like Christoc.Modules., that will become Christoc.Modules.ProjectName (where ProjectName is provided when you create the project in Visual Studio)
- ownername – The name used for Copyright text in the projects, and also in the owner information of the DNN manifest during module installation
- owneremail – The email address listed in the DNN manifest file used during module installation
- ownerwebsite – The website listed in the DNN manifest file used during module installation
- devenvironmenturl – The URL of your development environment, only change if you are using something different.
- Rename the *.vstemplate file to use a new name, ex: Christoc-VB-Module.vstemplate
- Select all the files in the extracted template folder (press Control-A)
- Right click on the *.vstemplate file
- Choose Send To
- Compressed Zip File
- Copy the newly created ZIP file (file should have the same name as the VSTEMPLATE file just with a ZIP extension)
- In Windows go to your My Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual Basic folder (or Visual C# if you are working with the C# templates)
- Create a new folder called DotNetNuke
- Paste the ZIP file copied in Step 8.iii into the newly created DotNetNuke folder
- Repeat the process for any additional templates you want to modify.
- Start Visual Studio 2012 (if you had it open already, close it and open again)
- Create a new project, choosing one of your newly created templates.
Modify the VSIX files
For the other approach to template customization you will want to download the Source for the DNNTemplates project on codeplex, make changes, and recompile that project to create your own VSIX file, you will then use this VSIX file to install your custom templates. I do recommend that you change the name of the templates using the VSIX manifest interface in Visual Studio. You can follow the steps below to customize and package your own templates.
- Install Visual Studio 2012 (currently available from MSDN downloads)
- Install Visual Studio 2012 SDK (currently available from MSDN downloads)
- Download the VSIX Source Code project from Codeplex (click here to go to codeplex
- Extract the package to a folder (I use c:\projects\dnntemplates\vsix)
- Open the Solution in the VSIX folder (dnntemplates.sln) in Visual Studio 2012
- Open the source.extension.vsixmanifest file (it should default into the designer)
- Change the Product Name to something other than DotNetNuke Project Templates
- Expand the CSharp-Template (mirror process for VB-Template to modify the VB template)
- Open the vstemplate files.
- Change the Name found within TemplateData in the vstemplate file, I would suggest relating this to the name of your company.
- Find the CustomParameters section and modify the Values of any of the necessary parameters.
- Now you will need to compile the DNNTemplates solution in Release mode, this will generate a new VSIX file under the vsix/dnntemplates/bin/release folder.
- Deploy the VSIX file by double clicking on the file (found in the dnntemplates/bin/release folder).
- V2.1 - Released 1/28/2013, contains a couple of changes for customizing the Templates
- V2.0 - Released 1/24/2013, contains both DAL and DAL2 templates for DNN 7.0.2 in both C# and VB.NET
- V1.0/1.1 - Contains a DAL template for DNN 6.2.* in both C# and VB.NET