RestoreDeprecatedFiles was scheduled right after InstallInitialize. When that
was "run" during the "immediate" or "writing the script", the
RestoreDeprecatedFiles property didn't (yet) exist (was blank), so that is what
gets passed to the CA. Later on you create the value, but it is never used.
You need to schedule SetRollbackData before RestoreDeprecatedFiles in the
sequence. Since the values that SetRollbackData uses come from (I assume you
are using DeleteDeprecatedFiles and not DeleteUserAdminDeprecatedFiles with the
same attributes, based on your log) that action must come before
SetRollbackData, which means you need that action to be After InstallInitialize
instead of before InstallFinalize.
-Blair
> From: tyler.w.r...@accenture.com
> To: wix-users@lists.sourceforge.net
> Date: Fri, 20 Dec 2013 16:30:29 +0000
> Subject: [WiX-users] Help passing properties to Rollback custom action.
>
> Hello,
>
> I have a custom action that moves some deprecated files from an old
> install to a temp directory during a major upgrade and I have another custom
> action to move them back that runs only during roll back. I am having trouble
> accessing the two properties set by the first custom action in my rollback
> custom action every time I access the CustomActionData dictionary in my
> rollback action it is empty even though in the MSI log I can clearly see it
> got set to the proper values.
>
> Below are the custom action definitions:
>
> <CustomAction
> Id="DeleteUserAdminDeprecatedFiles" BinaryKey="FileSearchCA"
> DllEntry="DeleteDeprecatedFiles" Execute="immediate" Return="check" />
>
> <CustomAction Id="RestoreDeprecatedFiles"
> BinaryKey="FileSearchCA" DllEntry="RestoreDeprecatedFiles" Execute="rollback"
> Return="ignore"/>
>
> <CustomAction Id="SetRollbackData"
> Property="RestoreDeprecatedFiles"
> Value="RootDir=[DEPRECATEDFILESROOTDIR];TempDir=[DEPRECATEDTEMPORARYDIR]" />
>
> Below is the scheduling of the actions:
>
> <Custom Action="SetRollbackData"
> After="DeleteDeprecatedFiles">
> OLD_VERSION_FOUND
> OR
> <!--Run if we are doing a major upgrade (msi -> msi).-->
>
> REMOVEINSTALLSHIELD
> </Custom>
> <Custom
> Action="DeleteDeprecatedFiles" Before="InstallFinalize">
> OLD_VERSION_FOUND
> OR
> <!--Run if we are doing a major upgrade (msi -> msi).-->
>
> REMOVEINSTALLSHIELD
> <!--Run if we are upgrading installshield
> instance.-->
> </Custom>
> <Custom
> Action="RestoreDeprecatedFiles" After="InstallInitialize"/>
>
> Below are the relevant Log entries:
>
> MSI (s) (20:D4) [07:53:29:229]: Doing action: DeleteDeprecatedFiles
> Action 7:53:29: DeleteDeprecatedFiles.
> Action start 7:53:29: DeleteDeprecatedFiles.
> MSI (s) (20:2C) [07:53:29:237]: Invoking remote custom action. DLL:
> C:\Windows\Installer\MSI2DDF.tmp, Entrypoint: DeleteDeprecatedFiles
> SFXCA: Extracting custom action to temporary directory:
> C:\Windows\Installer\MSI2DDF.tmp-\
> SFXCA: Binding to CLR version v4.0.30319
> Calling custom action
> FileSearchCA!FileSearchCA.FileSearchCA.DeleteDeprecatedFiles
> Starting UserAdmin delete deprecated files Custom Action.
> MSI (s) (20!A4) [07:53:29:413]: PROPERTY CHANGE: Adding
> DEPRECATEDFILESROOTDIR property. Its value is 'C:\Program Files\Duck Creek
> Technologies\ExampleUserAdmin\bin'.
> MSI (s) (20!A4) [07:53:29:417]: PROPERTY CHANGE: Adding
> DEPRECATEDTEMPORARYDIR property. Its value is
> 'C:\Users\LMUser\AppData\Local\Temp\kg2s3d3v.vqo'.
> Action ended 7:53:29: DeleteDeprecatedFiles. Return value 1.
> MSI (s) (20:D4) [07:53:29:458]: Doing action: SetRollbackData
> Action 7:53:29: SetRollbackData.
> Action start 7:53:29: SetRollbackData.
> MSI (s) (20:D4) [07:53:29:465]: PROPERTY CHANGE: Adding
> RestoreDeprecatedFiles property. Its value is 'RootDir=C:\Program Files\Duck
> Creek
> Technologies\ExampleUserAdmin\bin;TempDir=C:\Users\LMUser\AppData\Local\Temp\kg2s3d3v.vqo'.
> Action ended 7:53:29: SetRollbackData. Return value 1.
> MSI (s) (20:D4) [07:53:29:469]: Doing action: InstallFinalize
> Action 7:53:29: InstallFinalize.
>
>
>
>
> Rollback: RestoreDeprecatedFiles
> MSI (s) (20:D4) [07:55:19:904]: Executing op:
> ActionStart(Name=RestoreDeprecatedFiles,,)
> MSI (s) (20:D4) [07:55:19:906]: Executing op:
> CustomActionRollback(Action=RestoreDeprecatedFiles,ActionType=1345,Source=BinaryData,Target=RestoreDeprecatedFiles,)
> MSI (s) (20:60) [07:55:19:910]: Invoking remote custom action. DLL:
> C:\Windows\Installer\MSIDE33.tmp, Entrypoint: RestoreDeprecatedFiles
> SFXCA: Extracting custom action to temporary directory:
> C:\Windows\Installer\MSIDE33.tmp-\
> SFXCA: Binding to CLR version v4.0.30319
> Calling custom action
> FileSearchCA!FileSearchCA.FileSearchCA.RestoreDeprecatedFiles
> Starting rollback for Deprecated files.
> Printing CustomActionData.
> Error in Rollback Deprecated files...
> System.Collections.Generic.KeyNotFoundException
> The given key was not present in the dictionary.
> at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
> at FileSearchCA.FileSearchCA.RestoreDeprecatedFiles(Session session)
> MSI (s) (20:D4) [07:55:20:578]: Executing op:
> End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
> MSI (s) (20:D4) [07:55:20:581]: Error in rollback skipped. Return: 5
> MSI (s) (20:D4) [07:55:20:611]: Note: 1: 2318 2:
> MSI (s) (20:D4) [07:55:20:614]: No System Restore sequence number for this
> installation.
> MSI (s) (20:D4) [07:55:20:616]: Unlocking Server
> MSI (s) (20:D4) [07:55:20:631]: PROPERTY CHANGE: Deleting UpdateStarted
> property. Its current value is '1'.
> Action ended 7:55:20: INSTALL. Return value 3.
>
> Also for good measure the relevant code in the custom action:
>
> [CustomAction]
> public static ActionResult
> RestoreDeprecatedFiles(Session session)
> {
> try
> {
>
> session.Log("Starting rollback for Deprecated files.");
>
>
> session.Log("Printing CustomActionData.");
>
> foreach (var kvp
> in session.CustomActionData)
> {
>
> session.Log("{0} = {1}", kvp.Key, kvp.Value);
> }
>
>
> string
> deprecatedRootDir = session.CustomActionData["RootDir"];
> string
> deprecatedTempDir = session.CustomActionData["TempDir"];
>
> var di = new
> DirectoryInfo(deprecatedRootDir);
> var tempDir = new
> DirectoryInfo(deprecatedTempDir);
>
> if (!di.Exists)
> {
>
> di.Create();
> }
>
> foreach (var fi
> in tempDir.EnumerateFiles())
> {
>
> fi.MoveTo(Path.Combine(di.FullName, fi.Name));
> }
>
> return
> ActionResult.Success;
> }
> catch (Exception e)
> {
>
> session.Log("Error in Rollback Deprecated files...");
>
> session.Log(e.GetType().ToString());
>
> session.Log(e.Message);
>
> session.Log(e.StackTrace);
>
> return
> ActionResult.Success;
> }
> }
>
>
>
> Tyler Reid | Operations and Infrastructure | Accenture Software | P&C
> Insurance
> 1807 Jones Street | Bolivar, MO 65613| USA
> Office: +cc.xxx.xxx.xxxx | Fax: 417.777.3792
> E-Mail: tyler.w.r...@accenture.com<mailto:tyler.w.r...@accenture.com> |
> www.accenture.com/pcsoftware<http://www.accenture.com/pcsoftware>
>
>
>
> ________________________________
>
> This message is for the designated recipient only and may contain privileged,
> proprietary, or otherwise confidential information. If you have received it
> in error, please notify the sender immediately and delete the original. Any
> other use of the e-mail by you is prohibited. Where allowed by local law,
> electronic communications with Accenture and its affiliates, including e-mail
> and instant messaging (including content), may be scanned by our systems for
> the purposes of information security and assessment of internal compliance
> with Accenture policy. .
> ______________________________________________________________________________________
>
> www.accenture.com
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users