[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.setup

"The savedState dictionary contains inconsistent data and might have been corrupted." on Installer.Commit

funstercinsolata

8/16/2006 2:14:00 PM

Many people encountered this error (application installation throws
exception). It happens if you try to add a custom installer
(MessageQueueInstaller, EventLogInstaller,...) programmatically into
application installer code under public override void
Install(System.Collections.IDictionary stateSaver)". Installation does
work though, if installers are added via Designer (Add Installer from
context menu).

1) Solution that is WRONG (throws the exception):
----
public class ClientEventLogInstaller
:System.Configuration.Install.Installer
{

private EventLogInstaller myEventLogInstaller = new
EventLogInstaller();
private System.ComponentModel.Container components = null;

public ClientEventLogInstaller()
{
InitializeComponent();
}

public override void Install(IDictionary savedState)

{
myEventLogInstaller.Source = "myLog";
myEventLogInstaller.Log = "myLog";
Installers.Add(myEventLogInstaller);
base.Install(savedState);
}

2) Solution that WORKS:

public class ClientEventLogInstaller
:System.Configuration.Install.Installer
{

private EventLogInstaller myEventLogInstaller = new
EventLogInstaller();
private System.ComponentModel.Container components = null;

public ClientEventLogInstaller()
{
InitializeComponent();

myEventLogInstaller.Source = "myLog";
myEventLogInstaller.Log = "myLog";
Installers.Add(myEventLogInstaller);
base.Install(savedState);
}

public override void Install(IDictionary savedState)
{
}


All you have to do is move your custom installation initialization from
Install method to constructor!!