toverly
Posts: 5
Joined: Thu Jun 26, 2008 7:48 pm

Custom Action to prevent file delete

I have been working through the help file on how to create a custom action to prevent files from being over written during and upgrade. I have followed the example in the help files that deals with this specifically. However when I run the second installer package it goes almost to the end and give me a warning about how a script in the installer can't be run and the installation can't complete. It then rolls back to beginning. Has anyone had experience with a set up like this and if so have you experienced the same error?
Attachments
Error dialog.
Error dialog.
Error.JPG (13.79 KiB) Viewed 4924 times
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Custom Action to prevent file delete

Hi,

Usually this behavior is encountered when a custom action fails during the installation. Can you please send us the AIP (project) file you are using to support at advancedinstaller dot com so we can investigate it? Also, please attach a log of the installation.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Re: Custom Action to prevent file delete

Hello toverly,

perhaps post your custom action code.

Here is what I use to catch and log exceptions (note that all code in the custom action is enclosed in a try/catch block) to the MSI log facility:

Code: Select all

var sessionObjectExists;
try
{
	var s = Session.Property("CWD");
	sessionObjectExists = true;
}
catch (e)
{
	sessionObjectExists = false;
}

function log(msg)
{
	if (sessionObjectExists)
	{
		var rec           = Session.Installer.CreateRecord(1);
		rec.StringData(0) = "[1]";
		rec.StringData(1) = msg;

		Session.Message(msiMessageTypeInfo, rec);
	}
}

function myCustomAction()
{
	try
	{
		test;
	}
	catch(exc)
	{
		log("Exception    : " + exc);
		log("  name       : " + exc.name);
		log("  number     : " + exc.number);
		log("  message    : " + exc.message);
		log("  description: " + exc.description);
	}
}
You need to actively use the logging options, setting the respective parameters in the .exe that you generate, or passing them when installing the .msi file.

See output of "msiexec /?" for logging options.



With best regards

Clemens Anhuth

Return to “Common Problems”