- Visual Studio (I am using 2008, you could use 2005).
- SQL Server 2005 Express. (Needs to be installed with Mixed Mode Authentication)
- DNN Source (Either the Install package or the Starter Kit. If you are using the Starter Kit, install the starter kit so that it becomes integrated into VS).
Get the latest version of DNN from CodePlex. (I am currently using v5.00.01)
Creating a Database.
When using SQL Server, there are 2 ways in which you can setup your database:
- Attached database file:
This is the simplest method of working with DNN. The database file is created within the DNN install folder and you typically dont have to do anything. Even though this is the easiest option, I find creating a database within your DB server is easier to develop with, as you can use the SQL Server Management Studio to work with the database.
- Database attached to the server:
As written above, this is my preferred DB setup for DNN. This is because you can easily use SQL Server Management Studio to work with the database (adding tables, stored procs, etc.). Here is what you need to do:
A. Create a database
Right click on the Database node and select “New Database….”
In the New Database dialog, type a name for the database and click OK.
B. Create a Login
Right click on the Security\Login node and select “New Login…”
In the New Login dialog, type a name for the login, set the login type to SQL Server Authentication and set the password. Click OK.
C. Create a User for the DNN database
Navigate to the Security\Users node under the database you created in step (A). Right click and select “New User…”
In the New User dialog, type in a user name and select the login that you created in step (B) as the login name. Also, set “db_owner” as the “schemas owned by this user” and as the “database role membership”. Click OK.
That will create a database that can be used by your DNN install.
D. The connection string:
The connection string will look like this:
Data Source=localhost\SQLEXPRESS;Initial Catalog=dnn5DB;Persist Security Info=True;User ID=dnnLogin;Password=dnnLoginPwd;
where dnn5DB is the name of the database, dnnLogin is the name of the user and dnnLoginPwd is the password for the user.
You will have to update the bolded text in the code above to create a connection string specify to your settings.
Installing the DotNetNuke Source
Again, there are 2 major ways you can go about installing the DNN source to your machine:
- Use the DNN Install package
This is probably the simplest method for installing DNN to your machine.
The package you need for this, is typically called “DotNetNuke_Community_05.00.01_Install.zip”. Once you have downloaded the package, you need to unzip the contents to a folder on your machine. I prefer working with IIS server instead of with Cassini (the integrated web dev server in VS). This is because it makes it easier to find errors that you wouldn't otherwise come across until you push your code to the production server. Unzip the contents to a folder under “c:\inetpub\wwwRoot\”.
- Use the DNN starter kit for Visual Studio
To use this option you need to download the starter kit (DotNetNuke_Community_05.00.01_StarterKit.vsi) and first install it on to your machine. I prefer this method as it makes it easy to create multiple DNN installations on your machine. Once you have installed the starter kit, start up Visual Studio and go to New->Website. (Remember I am using VS 2008, so my steps might differ slightly if you are using VS 2005).
In the new web-site dialog, first select “Visual Basic” as the language (dont worry you will still be able to use C# as your language for creating modules). Once you have selected VB as the language you will see “DotNetNuke We Application Framework” under my templates. Select it. Now set the location to “HTTP” and set the location as “HTTP://localHost/FolderName” (where folder name must be provided by you).
The reason we use HTTP is that we wish to use IIS to host our DNN application. (Alternatively, you could install using a folder on the file-system and create a virtual directory in IIS that points to that folder).
Click OK. VS will churn for a bit, creating files on your machine. If you set the location as “Http://localHost/someLocation”, then the files will get created in “c:\inetPub\wwwRoot\someLocation”.
VS2008: Once done, Visual Studio 2008 will ask you if you would like to upgrade the project to use .Net Framework 3.5. Answer No. On my machine whenever I answered Yes, the project would become unusable and VS would shut down everytime I tried to open the solution. You can select the target framework later.
If you using the attached database file option then you can skip this step (this is the option where a database.mdf file is used in the app_data folder of your installation directory). Remember I prefer having my database attached to the server. As I have already setup a database to be used with my DNN installation, I am going to update the web.config file with the new connection string (remember, we created this in step (D) above).
- look for “SiteSQLServer” under the <connectionStrings> node. Update the connectionString for property for “SiteSQLServer” with the new connection string from step (D).
- look for “SiteSQLServer” under the <appSettings> node. Update its value to the new connection string from step (D).
My updated settings look like this:
Setting up file permissions
The next thing you need to do is to setup folder permissions, so that the user running the web-site has access to the folder. The user that is used for this is typically named ASPNET.
Navigate to the folder where the DNN source code was installed. (Typically c:\inetpub\wwwroot). Right click on the folder containing the DNN source code and select properties. Next select the Security tab and click the Add button.
Click locations and select the node that represents your computer (typically the top-most node) and then click OK. Type ASPNET in the text box and click “Check Names”. ASPNET, should change to a fully qualified name on your machine. Click OK.
With ASPNet account selected, click on the Modify permission (the other permissions should automatically get enabled).
Click on “Advanced”. Put a check on “Replace permissions on all child objects….” and click OK. (Answer yes, if you get a dialog asking you if you are sure).
Click OK in the Folder Properties dialog.
Setting up IIS settings
When you DNN web application is run, you need to tell IIS, which file needs to be opened by default. To do this, open up IIS Manager (found under Control Panel->Administrative Settings)
Right click on the node representing the DNN web-app and select properties.
(if the node does not look like a web-app, then you need to click the Create button to make the folder in to a web-app )
Select the Documents tab. If you do not see “default.aspx” in the list, then click Add, type “default.aspx” and click OK. Use the arrow keys on the left to move “Default.aspx” to the top.
Setting up DotNetNuke
DotNetNuke is installed using DotNetNuke!. When you run DNN for the very first time, it will detect that it needs to install the database tables, stored procs, etc, as well as configure the website, so that it can be used.
Run DNN by hitting CTRL + F5. (or Debug-> Start Without Debugging).
This is the moment of truth. If you installed everything correctly and setup permissions correctly, you should see the following web-page:
Select “Typical” and click next.
If you correctly updated your web.config file, then all the settings should automatically be populated into the Database configuration dialog. (If you are using the attached database option, the fields highlighted in yellow will have different values).
Enter the password. Select “Run as db Owner” and enter an object qualifier. (The object qualifier is a prefix that is applied to every object added to the database, this is extremely useful, when your database might hold objects from multiple apps, etc. Choose a short prefix: eg. dnn5)
Make sure that you test the database connection and that the test passes. Click Next.
At this point you should be able to login to your DNN portal using your host account.
If you get an error similar to “Could not load type 'DotNetNuke.HtmlEditor.FckHtmlEditorProvider.fcklinkgallery'” when you build your web-site, it is because in some versions (5.00.00) of DNN source/starter kit, the “DotNetNuke.FckHtmlEditorProvider.dll” was being deployed to the “Bin\Providers” folder instead of the “Bin” folder. If you move the dll from the providers folder to the parent bin folder, you should be able to successfully build DNN. This issue has been fixed with version 5.00.01 of DNN.