Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving multiple state Info in Custom Installer class .NET

Status
Not open for further replies.

assad999

Programmer
Mar 28, 2007
1
GB
Hi,

I'm currently setting up a deployment project using Visual Studio .NET 2003 which will deploy a web application. In my deployment project I’ve created a Custom Action by adding an installer class which overrides the Install and Uninstall methods.

In my install method, I'm trying to save a bunch of 'state' information in System.Collections.IDictionary so I added the following code:

stateSaver.Add("EnvironmentState", Me.Context.Parameters.Item("environment"))
stateSaver.Add("WebsiteState", Me.Context.Parameters.Item("Website"))
stateSaver.Add("VirtualDirState", Me.Context.Parameters.Item("virtualDir"))


In my Uninstall method, I have a simple windows message box which attempts to display one of these state information (I’m using just a message box in an attempt to debug the problem I’m getting), something like this:

MessageBox.Show(savedState("WebsiteState"))

When I run the Built MSI, the install process works fine. However when I attempt to Remove the web application through the MSI, I get the common ‘NULL reference exception'. I discovered that by adding more than one ‘state’ info (in the install class), causes this NULL reference exception. If I only have ONE state info, the uninstall process works fine (displaying the website value in the message box).

I thought that stateSaver.Add was OK for me to add multiple state information as long as I have a unique key. What’s going wrong?

Your help will be much appreciated.

Regards,
Assad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top