Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio
All postings are provided AS IS with no warranties, and confer no rights. Additionally, views expressed herein are my own and not those of my employer, Microsoft.
I posted an item on my blog last week with some details about how Windows Installer custom actions work behind the scenes. Some of the feedback I got back after posting this item asked some good questions about debugging strategies for custom actions. Based on that, I wanted to share a wrapper DLL written by Jungwook Bae, a developer on the Visual Studio and .NET Framework setup team. His tool makes the process of implementing and debugging DLL custom actions much simpler. You can download the tool itself by clicking here. The following is more information about the wrapper DLL and how to use it:
CATest - a tool that will help developing custom action DLLs
One of the biggest pains when writing custom actions is whenever you modify the DLL, you have to stream the new DLL into the MSI and restart setup. Deferred custom actions are the most difficult because you have to wait until all the files are copied and registry values are written again, which can take a very long time for large products.
To get around this problem, you can use catest.dll as a wrapper for the custom action DLL you are writing. You can test your custom action DLL without streaming it into your MSI, and you can run it as many times you want without restarting setup.
How to use CATest:
<update date="3/24/2009"> Fixed broken link to download the debugging tool. </update>
Aaron,
I second Steven's praise. However, while using catest to work on WiX v. 3's custom actions, I was wondering if it is possible within the catest.ini to have hooks for multiple actions of the same type (e.g. Immediate); I figured that catest could route to the correct action by the CustomAction.Action field. Here's my CustomAction table, to illustrate my point:
SchedSecureObjects 1 WixCA SchedSecureObjects
SchedSecureObjectsRollback 1 WixCA SchedSecureObjectsRollback
ExecSecureObjects 3073 WixCA ExecSecureObjects
ExecSecureObjectsRollback 3329 WixCA ExecSecureObjectsRollback
SchedServiceConfig 1 WixCA SchedServiceConfig
ExecServiceConfig 3073 WixCA ExecServiceConfig
RollbackServiceConfig 3329 WixCA RollbackServiceConfig
I have no problems setting catest up for one of each type, but what would I do in the INI in order to debug both SchedSecureObjects and SchedSecureObjectsRollback?
If catest doesn't handle this situation, is it possible to get source so that I can modify it to do so? Otherwise, I'm stuck reverse-engineering it (or writing a dll with yet another layer of indirection... hmm... that would probably work).
Thanks,
Tom
Hi Tomtrias - I will follow up with the creator of this CATest tool to see if it is possible to send you source code.
The is an easier way to debug the custom actions. Simply enter the following in the custom dll:
#if DEBUG
Debugger.Launch();
#endif
Then attach to the VS instance that has the code.
@mendezam
well i think you dont get the idear. The cool stuff is not tha fact to use a debugger. Its tha fact that you can rebuild and restart your CA without the need to restart your setup. So you can call it edit & continue ca debugging.
hi,
I believe that this is really helpful to a lot of ppl. I am not able to understand How to use CATest, it would be very nice if you can share some sample project with uses CAtest to debug
Hi Onam - I'm sorry, but I don't have any sample projects. There is a readme.txt inside of the .zip file for this tool that provides more details that might help get you started. Can you please take a look at that and let me know if you have any specific places where you get stuck?
The description of this is hard to understand. It would help if you give an example of just perform a deferred mode call to the CustomAction, what are the steps you need to go through to set that up.
Thanks!