To Visual Basic version
If you have followed the previous parts of this tutorial, you should now have your module and its controls installed on your local DotNetNuke site. This is a great starting point for creating an install package. When DotNetNuke installs an extension package (which is really just the extension’s files zipped together) it uses the installation manifest. The installation manifest is an XML document with a .dnn file extension in the installation package. Basically it tells DotNetNuke which files to put where and which database scripts to run on install/uninstall.
Lucky for us we have access to a great extension installation manifest generator; namely DotNetNuke itself.
Before we start creating the installation package we should finish an important part of it; the database uninstall script.
Back in part 3 we created the database install script where the table and stored procedures are created. In the uninstall script we should remove these.
Open up the file Uninstall.SqlDataProvider and replace its content with the following:
/** Drop Table **/
ALTER TABLE {databaseOwner}[{objectQualifier}SipidCode_Products] DROP CONSTRAINT [FK_{objectQualifier}SipidCode_Products_Modules]
GO
DROP TABLE {databaseOwner}[{objectQualifier}SipidCode_Products]
GO
/** Drop Stored Procedures **/
DROP PROCEDURE {databaseOwner}[{objectQualifier}SipidCode_GetProducts]
GO
DROP PROCEDURE {databaseOwner}[{objectQualifier}SipidCode_GetProduct]
GO
DROP PROCEDURE {databaseOwner}[{objectQualifier}SipidCode_AddProduct]
GO
DROP PROCEDURE databaseOwner}[{objectQualifier}SipidCode_UpdateProduct]
GO
DROP PROCEDURE databaseOwner}[{objectQualifier}SipidCode_DeleteProduct]
GO
Don’t forget to save the file.
The batch script you just created will be run when the module is uninstalled and drops the Products table and its foreign key constraint. It also drops the stored procedures we created.
At last we are ready to create the actual installation package! Log in as Host on your local DotNetNuke website and go to Host > Module Definitions. Scroll down to the
Products item and click the edit icon.
Scroll down to the section
Package Settings. Here you can fill in the fields if you like. Only the
Friendly Name field is mandatory.
When you are done, click the
Create Package link at the bottom.
The Create Package screen is displayed. Just click the Next link.
The Choose Files to include screen is displayed.
Only the files shown in the picture above should be included in the package:
- Database install/uninstall scripts
- Resource files
- Control markup files
If there are any others, delete those lines from the text box. Click Next when you are done.
The Choose Assemblies to include screen is displayed. Just click Next.
The Create Manifest screen is displayed.
The text box contains the extension installation manifest for the package.
Great to have it generated for you, isn’t it? When you are done admiring the manifest, click next.
The Create Package screen (not the same one as before) is displayed.
Remove the leading underscore character from the Manifest Field Name. A copy of the manifest file will be written into the project directory, overwriting the old and useless file we got from the template.
Finish by clicking Next.
The installation package is now created and written into the /Install/Module folder of your DotNetNuke installation.
You can now go ahead and install the package where you want. I would recommend you to set up another DotNetNuke site for testing your installations on. If you install it on your development site it will collide with your project files and possibly result in trouble.