Summary


Developing Modules with Visual Studio .NET 2005

Now let's look at the methods for creating a module using Visual Studio .NET 2005. Note that developing a module with VS 2005 means that you cannot run the module on DotNetNuke 3.x and the ASP.NET 1.1 framework.

First take a look at some of the changes you will encounter as you start to utilize this platform for developing your modules.

In the VS 2005 line of products, Microsoft wanted to reduce the entry barriers that many developers have historically experienced with their integrated development environment products. The professional Microsoft's IDEs have usually been expensive, which prevented a lot of novice and hobby developers from utilizing the Microsoft platform. This could probably account for some of the rapid growth seen with the LAMP suite of technologies.

Note 

LAMP is a free, open source web platform that utilizes Linux, Apache, and MySQL, and Perl, PHP, or Python scripting languages. The free software programs are used together to run dynamic Web sites or servers.

With the launch of ASP.NET 2.0, Microsoft is releasing a full suite of free development tools, which make up the Express line of development tools for .NET 2.0. The main Express tool you need to create DotNetNuke modules is the Visual Web Developer (VWD). You can also download and manage the SQL 2005 Express database engine and control it through VWD. You can download these products from http://msdn.microsoft.com/vstudio/express/vwd/default.aspx.

ASP.NET also comes with a file system web server, Cassini, which enables you to develop and test on your machine without having to set up IIS to accomplish these tasks. The web server is integrated with the Visual Studio line of products, which makes debugging your applications simpler. Integrating the simpler development structure along with the concept of Starter Kits helps reduce the learning curve associated with understanding how to develop DotNetNuke modules.

Starter kits were introduced with VS 2005. Microsoft has released several starter kits ranging from a Personal Site Starter kit to a PayPal- Enabled Ecommerce Start Kit. A starter kit essentially performs some of the remedial tasks associated with module development and what the AtGen SDK and VS templates mentioned earlier are used to accomplish. The DotNetNuke core team saw the benefit of these starter kits, especially for programmers who were new to the DotNetNuke framework, so the core created a DotNetNuke Starter kit, which you can download from www.dotnetnuke.com/tabid/125/default.aspx.

Installing the DotNetNuke Starter Kit

After you've downloaded the Starter Kit, execute DotNetNuke_4.0.2_StarterKit.vsi to install it on your computer. The Video Studio Content Installer dialog box (see Figure 12-9) opens, enabling you to select the kit components you want to install.

image from book
Figure 12-9

For now, leave all the items selected so the various options will be available for you to use in your projects. You may notice there is no publisher defined for this file, so you will receive a dialog telling you the file does not have a valid signature. The DotNetNuke core team will eventually start signing these files so you can be sure you're getting an official copy. This time, though, just click through the warning.

The next screen provides an overview of the projects you are installing. Click Finish and your templates will install.

Launch either Visual Web Developer or Visual Studio 2005 and choose New Web Site. (This example uses Visual Studio Team Suite, but the function is essentially the same if you are using VWD or one of the other versions of Visual Studio.) The New Web Site dialog's Templates page opens (see Figure 12-10).

image from book
Figure 12-10

Select the DotNetNuke Web Application Framework project because you will be creating a fully functional instance of DotNetNuke to develop against. Change the default web site name to DotNetNuke402, but accept the defaults for everything else and click OK. The application instance is created and you are presented with some additional documentation in your web browser that will guide you through the rest of the process: creating your database, modifying your connection string, configuring your web server and NTFS permissions, and launching the web site to enable the application to install the needed SQL scripts. For more information on installing DotNetNuke, refer to Chapter 2.

You now have a basic installation running and are ready to start creating a module. For this example, you create a Hello World module, but the process is similar for any module you are developing.

Hello World Module

Open the DotNetnuke project you created earlier in the process using either Visual Web Developer or Visual Studio 2005.In the Solutions Explorer, right-click the web site root — http://localhost/DotNetNuke402 — and select Add New Item. A dialog box like the one shown in Figure 12-11 opens.

image from book
Figure 12-11

Select the DotNetNuke Module template, rename your module HelloWorld, and click Add. The module is created with the structural work already done, so all you need to do is add your specific logic. Figure 12-12 shows all files created for you with the DotNetNuke Module template.

image from book
Figure 12-12

A document loads into your web browser, detailing a couple of manual steps you need to perform. Rename the Module Name folder to coincide with your module name, HelloWorld. This ensures that you won't have naming conflicts as you develop additional module for your portal. You must change this in two places:

  • Rename \App_Code\ModuleName to \App_Code\HelloWorld.

  • Rename \DesktopModules\ModuleName to \DesktopModules\HelloWorld.

You can accomplish this in your development environment by right-clicking the folder name in the Solutions Explorer and selecting Rename from the menu.

Now you need to put in your application logic. Add a simple label control to ViewHelloWorld.ascx with the text hello world. You can enter any logic you want into these files and the process is essentially the same as discussed in the Event module earlier in this chapter. After you have dropped the label onto the form, you can rebuild the web site and register your module into the DotNetNuke web site as you did earlier in the chapter. Your Hello World Module is ready to use in your portal.

That was really simple and if you are not planning to distribute your module to other developers, this is really the easiest and most efficient method for extending the functionality of your DotNetNuke web site. You still need to create the logic for your DataProvider, but that process is essentially the same as if you where developing in VS2003 and will be covered in the next three chapters.




Professional DotNetNuke 4.0 (c) Open Source Web Application Framework for ASP. NET 4.0
Professional DotNetNuke 4: Open Source Web Application Framework for ASP.NET 2.0 (Programmer to Programmer)
ISBN: 0471788163
EAN: 2147483647
Year: 2006
Pages: 182

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net