Archiv für August, 2007

Zataoca: Classes of Custom Actions

Friday, 10. August 2007 at 6:56 pm

Continuing the Zen and the Art of Custom Actions thread, I thought I’d post a mostly formed thought.  When I’m presented with the need to write a custom action I often mentally classify the work into one of three or so different buckets.  Now, I’m not sure the ideas presented here in capture exactly everything the way I want but it seems like a decent place to start discussion.  So, on with the classifications.

1.  Internal-only custom actions.  This class of custom actions operates purely on data available inside the MSI database.  Assigning a Property the value of another Property is a simple internal-only custom action.  A custom action that reads some table in the MSI and populates some other table with temporary rows is also an internal-only custom action.  Internal-only custom actions are usually easier to design and implement because their data is contained completely within the MSI itself.  Since internal-only custom actions do not interact with the “outside world” (i.e. anything on the machine) they usually have very few dependencies.

2.  Read-only custom actions.  This class of custom actions reaches out on to the machine to gather data for some other process of the install.  Usually, read-only custom actions access some data store (registry, SQL database, file system) and populate a Property or some table inside the MSI for later processes to act on.  These custom actions are usually a bit more complex than the internal-only custom actions because you have to think about what user context you are accessing the machine with (Local System or the installing user that is elevated or not).  Read-only custom actions also have to be robust to handle whatever circumstances they might find on a user’s machine.  Basically, there are a lot more unknowns when you start to reach outside of the MSI database and the code often has more dependencies that can fail.

3. System modification custom actions.  This class of custom actions is by far the most complex custom action to write.  These are the custom actions that go out and change some state on the machine.  They do all kinds of things from creating registry keys (bad, use the Registry table) to writing ACLs (yeah, I know the LockPermissions table sucks) to updating the IIS metabase (that’s what the standard WiX IIS CustomActions do) to talking to SQL Server (WiX SQL CustomActions can do much of that) to changing any other number of bits on the user’s machine.  System modification custom actions are difficult because they not only have to consider the context they are operating in, they usually have to be deferred (which is a fascinating set of future topics).  On top of that, system modification custom actions need to think about what they do to the machine when installing, uninstalling, repairing, patching and rolling back all of those operations.  Needless to say, designing, developing and testing system modification custom actions is a very onerous process.  I dread having to write a custom action that modifies the system state.

Anyway, that’s the three major classifications of custom actions that I typically consider.  There are probably different ways to split the classifications.  For example, launching a program at the end of the install is something that I would consider a read-only custom action or a system modification custom action depending on whether the launched application modifies system state.  In any case, these buckets tend to capture most of the concerns I immediately think about when the need for a custom action arises.

We’ll talk about custom actions more later.  Eventually, I’ll even get around to writing code or dissecting existing custom action code.

 

Original post by Rob Mensching

Abgelegt von CustomAction
von bingen

SDD before TDD?

Friday, 10. August 2007 at 5:25 pm

David Aiken has an interesting blog post about adopting TDD (Test Driven Development, for those of you have been living in a cave) for his next project.  In said blog post, David suggests that before even writing tests that one should write the setup logic:

First,  I’m adopting a TDD approach. So you would think my first piece of code was a test. WRONG! My first piece of code is the installer!

Installer? - there is nothing to install. Correct. But there is still an installer project, which compiles and builds and installs pretty much nothing. (It actually installs a DLL from the 1st project - the DLL contains an empty class otherwise you cannot build an installer). I’ve decided to use WIX as the installer technology (the same as we used for DinnerNow)

David’s line of thinking goes right along with my philosophy that setup should be integrated directly into the development process.  Maybe we should call this process of writing the setup project up front SDD for Setup Driven Development.  <smile/>

The same way that TDD encourages the development of code that can be better unit tested, SDD would encourage the development of code that can be better deployed.  I argue quite often that many of the problems developers face in setup were caused by poor design or implementation decisions early in the development lifecycle.  Setup Driven Development would flush out deployment complications as soon as they were introduced into the application.  Seeing the deployment issues right away better enables the developer to make a decision to address the issue by writing complex setup logic or by simplify the application’s deployment needs.  I would often encourage the latter.

Hmm, maybe this Setup Driven Deployment idea isn’t so crazy after all…

 

Original post by Rob Mensching

Abgelegt von Uncategorized
von bingen

WiX toolset in SlickEdit 2007

Friday, 10. August 2007 at 5:02 pm

I’ve never really used SlickEdit but had a few friends that just lived in the editor.  Anyway, tonight I tripped across this blog entry that talks out some integration tricks you can do with .wxs files in SlickEdit.  If you use SlickEdit and the WiX toolset you might check it out. 

 

Original post by Rob Mensching

Abgelegt von WiX
von bingen

Zen and the Art of Custom Actions

Friday, 3. August 2007 at 4:23 pm

I have been asked a great many times to talk about how to create Windows Installer custom actions.  Each time I’ve dismissed the request noting that it would take tons of time to organize my thoughts on the topic and actually write them all down.  I just don’t have that kind of time.  Besides, I gave up trying to create comprehensive blog entries a long time ago.

So, I’ve decided to compromise and at the same time test Technorati’s search-ability of tags here.  What I’m going to do is write random topics about creating custom action and use the tag zataoca.  There will be no series here.  One blog won’t necessarily follow logically from another.  Each topic will stand alone and hopefully the search engine will be able to tie the body of knowledge back together again.  It seems everyone searches for everything now anyway, so let’s see how far we can push it.

If you didn’t guess, zataoca stands for “Zen and the Art of Custom Actions” a title borrowed heavily from the incredible book Zen and the Art of Motorcycle Maintenance.  If you have never read that book, do so.

Speaking of things to I highly suggest reading, the following are a few links to custom action topics to get you in the mood.

1.  MSI SDK Topic about Custom Actions

2.  My blog entry why Script Custom Actions suck

3.  Heath Stewart describes another reason why Script Custom Actions suck

Until next time, keep coding… you know I am.

 

Original post by Rob Mensching

Abgelegt von CustomAction
von bingen