Introduction

I'm a DotNetNuke(DNN) evangelist. Many a late night has been spent coding new modules, building skins, and not-so-patiently waiting for the next version to arrive. If I have any complaints about DNN, it is about the fact that DNN has a constant "under construction" sign on its door. It is never really quite finished, because as soon as one release comes out, some newer, cooler technology comes down the road, and off goes the core team to integrate it and bring it to the grateful minions. So can I really complain at all?

One downside to that constant development cycle is that sometimes the "spit and polish" falls to the wayside. It is a product made by developers for developers, and so we just dig in and get our hands dirty when needed. But it would be nice if some things were just a little easier for the novice.

A noticeably lacking feature of DNN is an installer. In order to install the portal, you have to unzip the files, set permissions, create a virtual directory, create a database, and edit configuration files. Not a problem for most visitors of CodeProject. But that might be a handful for your novice programmer or anyone not intimately familiar with ASP.NET, IIS or MS SQL.

I didn't happen to have an extra few hundred dollars laying around in order to purchase a copy of InstallShield or Wise and create one of those "pretty" installers, so I rolled my own. NUKEleus is the end result. I hope you enjoy it.

Features

NUKEleus is a typical wizard in every sense. The interface looks nice and was easy to create due in large part to the Wizard Framework from DivElements. NUKEleus will walk you through the following steps, handling all the messy work for you.

Creates a blank database in SQL Server (you can choose the database name).

Edits the Web.Config file with your custom information.

Edits the DotNetNuke.sln and DotNetNuke.vbproj.webinfo files so that you can open the solution.

In addition, NUKEleus is open source, and under the standard GNU license, so it can grow and gather support from the community as needed.

Stumbling Blocks

Writing this installer was a real learning process for me. I had no idea how to perform several of the necessary actions, such as creating virtual directories and assigning NTFS permissions. And I'm still not 100% happy with the way things have been implemented. But the program is working, and that is the first step. I'm hoping that the community will jump in with more code to make this an even more polished product than it already is.

Assigning NTFS Folder Permissions

Probably, the hardest part of getting started with this problem was figuring out how to Google on it. "Give <machinename>\ASPNET rights to a folder" was not getting me any results. Several hours and several Advil into my search, I started to come across some rather interesting acronyms, such as Security Descriptors (SDs), Access Control Lists (ACLs) and Access Control Entries (ACEs). All of these have to do with setting security permissions - not only on folders, but on almost anything. The bad news was that .NET does not seem to have a library built into it that handles these (at least not that I'm aware of). Most of the source code examples available were in C++, which didn't help me in a VB.NET environment. Other examples were in older code, such as this example of high level routines from MSDN. After much trial and error, I just wasn't getting the results I wanted, so I fell back on a command line utility that I located to complete the job. Once I get this article published, I intend to look into this problem a little further.

Creating a Virtual Directory

Creating virtual directories programmatically was a little easier, not only because I was able to locate some code for it, but because .NET supported it to begin with. It's not an intuitive process however. I don't think a quick peek into the MSDN library would make it clear. The key to creating VDir's is the System.DirectoryServices.DirectoryEntry. Although the code below is rather long winded, the nutshell version is that you need to create a Directory entry, assign the necessary properties to it, and then commit the changes. In that regard, it is somewhat like adding a record to a database. Anyway, here is the code:

Unzipping a ZIP File

Here again, I'm rather surprised that such a common requirement is not handled by internal .NET libraries, but - it isn't. Fortunately, the community jumped rather quickly on this one, and produced a wonderful library called SharpZipLib. Unzipping using this library is rather straightforward, and there are examples on the web of how to do this. What I'll make you note however is the RaiseEvent call at the bottom of the code. Since unzipping a large file (all the DNN files are large) can take a while, I thought it is best to run this operation in a separate thread. This allows the end user to pause or cancel the unzipping operation as needed. I'm still pretty new to the whole multi-threading paradigm, but its about time VB.NET gained this ability.

A Blatant Plug For Self

I love writing wizards and tools. I quickly realized that one thing I do over and over is create special fields to locate files and folders. To that end, I created the BrowseControls. They allow you to drop controls right on your WinForm and never think again about all the coding it takes just to pick a file or folder from a hard drive.

Musings and Warnings

NUKEleus is a relatively untested product at the moment. Use it with care. It is intended for new installations of DotNetNuke only. It can be used for upgrades, but doing so will overwrite your Web.Config and recreate your virtual directories, etc. You should always backup your files and database before attempting any kind of DNN upgrade anyway.

In order to keep this software open and growing, I have also added it to SourceForge.

Wrap Up

I hope you like this program, and know you'll love DotNetNuke if you get to know it. If you have any comments, suggestions or fixes, please make your voice heard.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

Share

About the Author

Todd Davis has been working in web and application development for several years, using Silverlight, ASP.NET, VB.NET, C#, C++ and Javascript, as well as a great deal of work with SQL server and IIS.

He currently works for Virtual Radiologic in Eden Prairie, MN, however he is better known for his varied work in the open source community, especially the DotNetNuke project for which he provided several world-renowned training videos and modules. A huge advocate of open source and open knowledge sharing, everything on his website (www.SeaburyDesign.com) is always offered for free.

Whenever he is not actively coding at his laptop (a rarity to be sure), he can be found woodworking, walking with his wife and kids, or motoring along the back roads of MN on his Harley Davidson Fatboy.

DotNetNuke has changed significantly since the posting of this article. Such is the nature of open source software. In any event, I believe this was written somewhere in the 3.x era. Since DNN now comes with the Quickstart, and because VS 2005 no longer needs you to jump through all the hoops it once did in regards to creating virtual directories and assigning folder rights, most of this is uneeded. What I can tell you is that, with some minor work and tweaks, this is still a viable program. The code is there to create the database, the virtual directory, unzip the files, assign the permissions - the enterprising developer can simply take what he needs and work it into his own paradigm.

At one point the DNN team was going to make their own version of this installer (which is why I stopped working on this one), but I never heard of that coming to fruition.

The latest source file doesn't contain a web.config file, so any entries (sql connection string) etc still have to be done by hand. Maybe this installer could be modified to create a web.config if none is found.

I'll have to go back and look at the code. DNN has changed substantially in the past year, and many of the files have been reorganized and moved. I forget off the top of my head what code I used to determine if this was a valid DNN file, but I assume I was looking for dotnetnuke.dll or something like that, which is likely in a new place in the zip file.

Of course, you are free to poke through the code yourself, and either yank or change the line that's failing. I'm not sure if this code is still compatible with the most recent versions of DNN however.

I found your installer after pulling my hair out trying to install DotNetNuke "manually". I'm still not sure what I was doing wrong, but nonetheless, I wish I had found this yesterday, perhaps I could have enjoyed my weekend

It seems , the property seeting VDir.Properties("EnableDefaultDoc")(0) = True is not working. I am not getting that check for the "Enable Default Document" option.Are you aware of this..? Do you have a fix. ?

i am so gratefull you did this install wizzard. I was trying to install DotNetNuke 3.1 the whole day. But since i did not found a decent installation instruction about dnn 3 / 3.1 and lots of other errors (missing web.config , missing Assemblies, lack of write permission on logfiles, ...) i tried your program with version 3.09 of dotnetnuke in advanced mode, created the database by hand and wush after my second try and only after 15 minutes max everything was running fine.

Great job Todd. I was going to do something like this a little while ago but hadn't found the time. Does this install have an unattended or command line install ability. I was thinking it would be handy to script this to reset a bunch of testing setups that I have.

No, not yet. Since it still references a valid DotNetNuke zip file at some point, it needs to know which file you want to use. And obviously, it needs your SQL server login/password/location, etc. There is a Quick Install option, which assumes some of the "standards" such as the directory and virtual directory names.

I think having a command line version is a great idea though. I'll look into that.

Thanks - yet another great suggestion. This version of the tool is admittedly a real hack job - I threw it together over the course of two evenings while my three year old was putting stickers on head...

In the next version, I'll throw all the implementation into classes, and create a command line version as well. Also, the folks at the DNN forums have given me some very good suggestions which I'd like to implement. And I'd really like it to handle upgrades as well as new installs.

I've been researching the Enterprise Library lately, and I think I'll be using those tools for configuration logging and other resources with this project.

New releases will be handled at the SourceForge site, nukeleus.sourceforge.net