Before going through the steps on this page you should make sure you've gone through
Setting up your Module Development EnvironmentCustomizing a Visual Studio Project TemplateNew Templates for Visual Studio 2012
There are new project templates available for Visual Studio 2012, you can
read more about them here.
Creating A Project with the Template
In order to utilize a project template you need to start up Visual Studio 2008. When you Visual Studio opens, it loads all the templates from the templates folder.
Now that you have Visual Studio open you should click on File>New>Project. In the new project window Navigate to your Visual C#/Web folder under project types, after doing so you should see something like the following.
In that window be sure to choose the new template that you installed, in my case I’m going to access Christoc.com C# Compiled Module. From there I can populate the project properties below. In the screenshow below I’ve populated the key project properties.
The NAME of our project is going to be important going forward, whatever you type in for Name will become the project name, the name of the DLL and part of the namespaces for your project. You can always change the name later, but you’ll have to change it in a large number of places, so I suggest you name your project carefully. In my example here I’m calling the module ModuleName2, not an idea naming convention, but for example purposes it will suffice.
The LOCATION of our project is also very important, notice in the screenshot I placed the project in c:\websites\dnndev\desktopmodules\ DNNDEV is my development environment that I configured in the previous blog post (you read that one right?). So we are creating our project within the DotNetNuke environment, this will aid in our development and debugging for the module, there is no need to move files from one folder to another to start using our module in our development install of DNN. The Project that will be created based on this template requires that you put your project into the website/desktopmodules folder, if you put it elsewhere when you compile the module the DLL will be placed into the website/bin folder, in my case into c:\websites\dnndev\bin\.
The other option you should make sure you follow, uncheck the “Create directory for solution” checkbox on the project creation screen. This will prevent Visual Studio from creating our project inside of c:\websites\dnndev\desktopmodules\ModuleName2\ModuleName2, we want the project and solution files to reside in c:\websites\dnndev\desktopmodules\ModuleName2, not within a sub folder of that folder.
Once you have configured the New Project window click OK and Visual Studio will create the project and all the associated files based on the template for you.
Final Project Configuration and Compilation
After creating your project, inside of Visual Studio you will see a window appear that will display a list of instructions for you
Here is what you need to do. Right click on the Project in your Solution Explorer, and choose Properties. From the Project Properties window we want to go to the Web tab.
In the Web tab we need to configure a couple of settings. For our Start URL we are going to use http://dnndev/ (the URL we created in our environment configuration entry)
We then need to configure the Use Local Web Server option, the Project URL ishttp://dnndev/desktopmodules/ModuleName2 and the Override application URL setting should be http://dnndev/
Once you have modified these settings you can save your project and close the project properties window. Now you can compile! Being a keyboard junky I would suggest using Control-Shift-B, this will do a build of your project, and if you haven’t broken anything the build should compile successfully. The process of building the module compiles the code into a DLL and places that DLL into the c:\websites\dnndev\bin folder with the name of ModuleName2.dll
Now that you have a project you should check out the
Automated Module Packaging page.
Video Examples
Creating the Task Manager Project