Local IIS is a Must for a Newbee DNN Module Developer
Install the base DNN in the local IIS and get that going completely first. It will complicate less for module development as it will need to look up images and other resources in the directory structure.
Where To Store The Project?
The best place seems to be within the DesktopModules folder, create a project directly in there. Then all the references are good to go. By the way, target your project to .NET 3.5
Be sure to uncheck Create Solution Folder box when creating a project in this manner.
What To Type into The Assembly Name and Default Namespace?
- Type in the same info on both field by replacing YourCompany in the Assembly Name part with what you do, and then copy and paste that to the Default Namespace. This is for C#. I don't know VB at all so I will leave that up to you for VB.
- Do not do a Globally Replace of YourCompany to whatever. See below!
Do Not Globally Replace YourCompany With Your Real Company
You will get the following type of error message from Edit....ascx.deginer.cs if you immediately try to compile the project.
DotNetNuke Error 11 'System.Web.UI.UserControl' does not contain a definition for 'Text'
The reason why this happened was that global::DotNetNuke.UI. classes was inadvertently changed by the Visual Studio to global::System.Web.UI
How To Replace YourCompany
Note that order in which this is done is very important. Do not do these in out of sequence.
- Make a backup copy of the module project folder so that if you mess these steps, you can get them back.
- Open any of the classes in the control. And on the Namespace, right click over YourCompany and use the Refractor menu to change this to whatever you like.
- Open the Manifiest file (the one that ends with .dnn). On this one Replace YourCompany. with empty string. This fixes the install folder name from YourCompany.YourModule (make sure that the path does match with how you created your module root directory in the DesktopModules folder.
- Save everything.
- Make a backup copy of this folder again.
- You can now Quick Replace the rest of the files containing YourCompany (for example SQL Provider files). Use the Quick Replace at the Solution level.
Configure the Project's IIS
Next Configure the Project to Use the Local IIS Server so that images, controls and other resources in your development environment. Otherwise, your design surface will have errors. Also if any of the controls on the design surface errors out with a COM error, that means you probably did not follow my previous steps to refactor the classes properly which swapped the controls to the system default ones (not DotNetNuke.UI.Control ones), and ended up globally replacing YourCompany in the classes. You need to start over the project and follow the steps.
- Open the project property
- Select the Web tab on the left.
- Select "Use Local IIS Server"
- In the project URL, point it to the URL of your project within the DesktopModules folder. For example, http://localhost/DNN/DesktopModules/MT3 would be that I have the module project named MT3, and I have installed the DNN root at localhost/DNN
- Click Override application URL and type in the base URL for the DNN, for example, on my machine it is http://localhost/DNN
- This will also create web.config files in the folder which will interfere with the module loading. Rename it to xweb.config just in case you need it in the future.