Executing Custom .NET Class before Add Resources - Advanced Installer Community
dpetrasch
Posts: 4
Joined: Thu Aug 15, 2013 9:01 am

Executing Custom .NET Class before Add Resources

Hello all,

i am currently faced with the following problem and I haven't found an adequate solution yet. The forum revealed some posts about this topic, but not for this specific task. (or it was discussed with V 3.x)
I am sure that others may also be interested in this post, due it may be a common task.

Task:
I am updating a third party MSI and remove the package from the System and then installing mine. I already configured the update mechanism using the associated Upgrade Code. This works very well. New files are written and the setup deploys and registers all necessary components.

While updating, some tasks need to be performance before the old installation will be removed. I choosed a custom .NET C# Class (WiX Toolkit) that will handle this tasks.

I have the following problem:

I am currently calling the custom action "before" Add Resources. This, of cause, generates the error that the file is not available and can't be executed. Due to the limitation of moving the Install Execution State (i think its MSI limitation) the remove "old" product will be removed before the custom code will be deployed to save the information and tweak some settings.

my thoughts:

I need to make sure that the .dll is deployed before removing the old product.

Is there another way to do this? I already put the .dll-file in "Windows Volume/Temporary" in case this will be deployed earlier. It seems it isn't. What options do I have else?

Thank you very much,

Regards

Dennis
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Executing Custom .NET Class before Add Resources

Hi Dennis,

The correct way is to add the DLL generated by the VS solution as a "Launch attached file" custom action.

Attached file custom actions don't need to file to be included in Files and Folders page, so you can delete the file from there.
These custom actions include the DLL automatically in the MSI, in Binary table, so the DLL is available at any moment during the execution of the MSI,
therefore eliminating the restrictions you currently encounter.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dpetrasch
Posts: 4
Joined: Thu Aug 15, 2013 9:01 am

Re: Executing Custom .NET Class before Add Resources

Hello Bogdan,

thank you for your answer. It really helped.

If others are faced to the same problem: You can select a .dll within the "Launch attached file". Normally this seems impossible, because the filter on the "Open File Dialog" does not show .dll-Files. But you can select "Show All" and then select your .dll.

Make sure to select the appropriate Method-Name from the provided ComboBox.

Return to “Common Problems”