· Chris Hammond
Last Updated

New Visual Studio 2012 Project Templates for DotNetNuke

Discover the latest on Visual Studio 2012 RTM as Microsoft prepares for its official release in September. Gain insights at weblogs.asp.net.

Discover the latest on Visual Studio 2012 RTM as Microsoft prepares for its official release in September. Gain insights at weblogs.asp.net.

dnntemplates-1

Earlier this month Microsoft put the bits up for Visual Studio 2012 RTM out on MSDN Subscriber downloads, and during the first two weeks of September they will officially be releasing Visual Studio 2012. I started working with VS2012 late in the release candidate cycle, doing some DNN module development using my templates at https://github.com/chrishammond/dnntemplates.

These templates work fine in Visual Studio 2012 from my testing, but they still face the same problem that they had in Visual Studio 2008 and 2010, you have to install the MSBuild Community Tasks project prior to using the templates, otherwise projects failed to be created.

The other problem with the templates is that they are not easily discoverable, you couldn’t find them in Visual Studio, and they weren’t part of the Visual Studio Gallery. Enter the latest version of my module development templates.

I’ve from the ground up rewritten the project templates, and built them into a VSIX package, a unit of deployment for Visual Studio 2012. While it is true that you can create VSIX files that work in both Visual Studio 2010 and 2012, this project was designed specifically for 2012, and will not likely work in 2010, though I will do some testing and see if I can’t make it work in the future.

Overview of the DotNetNuke Project Templates

There are currently two templates available within the project, one for C# and one for VB.Net. These templates utilize MSBuild for automated packaging of the modules you create, just as previous versions of the templates have. They create compiled modules, meaning stand-alone projects, that have their own DLLs, making them easy to deploy and manage. They differ slightly from the previous version of the templates in that the deployable packages are now in the INSTALL folder within the module, instead of the packages folder.

You can now download new templates directly from within Visual Studio using the Tools > Extensions and Updates menu option. The templates are currently packaged as a Tool in the Visual Studio Gallery, not as individual template projects, so they can only be found by searching for them online, or via the Tools > Extensions and Updates option. As I release new versions of the template project you will be able to upgrade to the later templates using the same Extensions and Updates interface.

In order to start using the templates for your module development within DotNetNuke you will need to perform a number of steps, the first thing being installing the templates (if you don’t have Visual Studio 2012 installed, that would be your first step).

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

  1. Mouse over the Tools menu
  2. Click on Extensions and Updates
  3. Search for DotNetNuke
  4. Choose the Install button for the DotNetNuke Project Templates option
  1. Visit the Visual Studio Gallery – DotNetNuke Project Templates page
  2. Download the VSIX file via the Download link.
  3. Double-click on the downloaded file to install the templates.

Install manually by downloading from Codeplex

  1. Download the VSIX file from Codeplex
  2. 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 set up a project based on the templates. To do so you should follow the steps below:

  1. (you should have this done already) Install Visual Studio 2012
  2. (you should have this done already) Install DotNetNuke Project Templates from the Visual Studio Gallery
  3. Setup your DotNetNuke Development environment (the templates assume you have your development environment set up at http://dnndev/).
  4. Run Visual Studio 2012 as an Administrator (right-click on the shortcut to do so)
  5. File > New Project
  6. Choose either C# or VB.Net from the Languages section of the new project dialog
  7. Select the DotNetNuke Folder under your preferred language (C# or Visual Basic)
  8. Choose either DotNetNuke C# Compiled Module or DotNetNuke VB.Net Compiled Module for your project template
  9. Configure the new project as follows:
    • Name: ModuleName (e.g., DNNTaskManager)
    • Location: c:\websites\dnndev\desktopmodules\
    • Solution: Create new solution
    • Create directory for solution: Unchecked
    • Add to source control: Unchecked
    • Click OK

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. To do so:

  1. Install Visual Studio 2012
  2. Install Visual Studio 2012 SDK
  3. Download the VSIX Source Code project from Codeplex: Click here
  4. Extract the package to a folder (e.g., c:\projects\dnntemplates six)
  5. Open the Solution (dnntemplates.sln) in Visual Studio 2012
  6. Modify the source.extension.vsixmanifest file
  7. Modify the template .vstemplate files as needed
  8. Compile the solution in Release mode to generate the new VSIX file
  9. Deploy the VSIX file by double-clicking it

What’s Next for the Project?

My intention is to create additional templates to be included within the DotNetNuke Project Templates package, such as one for custom skin development. I will also be adding ItemTemplates into the distribution in the future.

If you have any feedback, please post on the Discussion portion of the Codeplex project.

Back to Blog

Related Posts

View All Posts »