This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Having trouble with WIX DTF
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 23, 2010
03:34 PM
Having trouble with WIX DTF
This is definitely a PEBCAK issue.
I downloaded WIX, created a VB.NET CA with it. Here's the code:
At this point, I compiled the code. WIX's fantastic MSBuild extension ran MakeSfxCA for me automatically. So, at this point, I have MyCustomActions.CA.dll built. I drop that binary into my install. I should mention that my install has a .NET 3.5 SP1 prereq, so I am definitely laying down .NET.
I go to Installshield's CA screen, and tell it I have a new 'MSI DLL'-->Installed with this package. I point it at MyCustomActions.CA.dll. I tell it my function name is BackupConfigFiles, and tell it to run synchronously and also that I want it to execute with deferred execution in system context. I sequence it directly after InstallInitialize.
I build the install, boot up a clean VPC with XP SP3 and run the install. The install (which, without the CA, runs fine), no longer installs. I review the detailed MSI log and see this:
[CODE]
Action 16:00:12: MyBackupFiles.
MSI (s) (C8:28) [16:00:12:639]: Executing op: CustomActionSchedule(Action=MyBackupFiles,ActionType=3089,Source=C:\Program Files\My Product\MyCustomActions.CA.dll,Target=BackupConfigFiles,)
MSI (s) (C8:0C) [16:00:12:639]: Invoking remote custom action. DLL: C:\Program Files\My Product\MyCustomActions.CA.dll, Entrypoint: BackupConfigFiles
MSI (s) (C8:0C) [16:00:12:639]: Generating random cookie.
MSI (s) (C8:0C) [16:00:12:649]: Created Custom Action Server with PID 1304 (0x518).
MSI (s) (C8:28) [16:00:12:699]: Running as a service.
MSI (s) (C8:28) [16:00:12:709]: Hello, I'm your 32bit Elevated custom action server.
Action ended 16:00:12: InstallFinalize. Return value 3.
MSI (s) (C8:28) [16:00:12:719]: User policy value 'DisableRollback' is 0
MSI (s) (C8:28) [16:00:12:719]: Machine policy value 'DisableRollback' is 0
MSI (s) (C8:28) [16:00:12:729]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1022853127,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
MSI (s) (C8:28) [16:00:12:729]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (C8:28) [16:00:12:729]: Executing op: DialogInfo(Type=1,Argument=My Software)
MSI (s) (C8:28) [16:00:12:729]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
Action 16:00:12: Rollback. Rolling back action:
Rollback: MyBackupFiles
[/CODE]
OK, so what am I doing wrong? I would have at least expected to see 'Begin BackupConfigFiles' in the log file, because that's the first line of code in the CA's function! So, apparently, it's unable to find the BackupConfigFiles function?
Please help!:confused:
I downloaded WIX, created a VB.NET CA with it. Here's the code:
Public Class CustomActions
_
Public Shared Function BackupConfigFiles(ByVal session As Session) As ActionResult
session.Log("Begin BackupConfigFiles")
Dim configPath As String = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles), "My Product")
For Each configFile As String In session.Database.ExecuteStringQuery("SELECT `File` FROM `File` WHERE `Component_` = 'ConfigFiles'")
If File.Exists(Path.Combine(configPath, configFile)) Then
File.Copy(Path.Combine(configPath, configFile), Path.ChangeExtension(Path.Combine(configPath, configFile), "bak"), True)
session.Log("Changed extension of " & configFile & " to .bak")
End If
Next
session.Log("End BackupConfigFiles")
Return ActionResult.Success
End Function
End Class
At this point, I compiled the code. WIX's fantastic MSBuild extension ran MakeSfxCA for me automatically. So, at this point, I have MyCustomActions.CA.dll built. I drop that binary into my install. I should mention that my install has a .NET 3.5 SP1 prereq, so I am definitely laying down .NET.
I go to Installshield's CA screen, and tell it I have a new 'MSI DLL'-->Installed with this package. I point it at MyCustomActions.CA.dll. I tell it my function name is BackupConfigFiles, and tell it to run synchronously and also that I want it to execute with deferred execution in system context. I sequence it directly after InstallInitialize.
I build the install, boot up a clean VPC with XP SP3 and run the install. The install (which, without the CA, runs fine), no longer installs. I review the detailed MSI log and see this:
[CODE]
Action 16:00:12: MyBackupFiles.
MSI (s) (C8:28) [16:00:12:639]: Executing op: CustomActionSchedule(Action=MyBackupFiles,ActionType=3089,Source=C:\Program Files\My Product\MyCustomActions.CA.dll,Target=BackupConfigFiles,)
MSI (s) (C8:0C) [16:00:12:639]: Invoking remote custom action. DLL: C:\Program Files\My Product\MyCustomActions.CA.dll, Entrypoint: BackupConfigFiles
MSI (s) (C8:0C) [16:00:12:639]: Generating random cookie.
MSI (s) (C8:0C) [16:00:12:649]: Created Custom Action Server with PID 1304 (0x518).
MSI (s) (C8:28) [16:00:12:699]: Running as a service.
MSI (s) (C8:28) [16:00:12:709]: Hello, I'm your 32bit Elevated custom action server.
Action ended 16:00:12: InstallFinalize. Return value 3.
MSI (s) (C8:28) [16:00:12:719]: User policy value 'DisableRollback' is 0
MSI (s) (C8:28) [16:00:12:719]: Machine policy value 'DisableRollback' is 0
MSI (s) (C8:28) [16:00:12:729]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1022853127,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
MSI (s) (C8:28) [16:00:12:729]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (C8:28) [16:00:12:729]: Executing op: DialogInfo(Type=1,Argument=My Software)
MSI (s) (C8:28) [16:00:12:729]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
Action 16:00:12: Rollback. Rolling back action:
Rollback: MyBackupFiles
[/CODE]
OK, so what am I doing wrong? I would have at least expected to see 'Begin BackupConfigFiles' in the log file, because that's the first line of code in the CA's function! So, apparently, it's unable to find the BackupConfigFiles function?
Please help!:confused:
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 23, 2010
05:11 PM
All the normal rules for deferred custom actions still apply. You won't have access to the database object to query the database. You need to do that in an immeadiate custom action, serialize a useful dataset and then pass it to your deferred using the CustomActionData class.
Also remember that when looking at a logfile for deferred CA's, you'll see one entry saying that it's scheduling your action and then later inside install finalize you'll see another entry saying the action is actually starting.
For DTF look for the work "sfxca" in your log as this is where you'll find your code actually being called. You are likely to see messages saying that CLR 2.0 is being used to invoke your class and then a stack dump complaining that it can't access the database.
Be sure to visit my blog and search for "DTF" for good examples. Finally InstallShield might get annoyed with my DTF evangalism so you can always take questions to InstallSite.org's forum or StackOverflow.com. The irony is I once praised them for pushing forward with managed custom action support when others in the industry deemed it a bad thing.
Also remember that when looking at a logfile for deferred CA's, you'll see one entry saying that it's scheduling your action and then later inside install finalize you'll see another entry saying the action is actually starting.
For DTF look for the work "sfxca" in your log as this is where you'll find your code actually being called. You are likely to see messages saying that CLR 2.0 is being used to invoke your class and then a stack dump complaining that it can't access the database.
Be sure to visit my blog and search for "DTF" for good examples. Finally InstallShield might get annoyed with my DTF evangalism so you can always take questions to InstallSite.org's forum or StackOverflow.com. The irony is I once praised them for pushing forward with managed custom action support when others in the industry deemed it a bad thing.