Running code during application installation

A pretty common question on our developer newsgroups is how to run code during the installation of an application to Pocket PC or Smartphone. This can be particularly helpful on uninstall where you need to remove files that are created by your application at run time, rather than install time. Setup DLLs can be used for any type of project, native or managed, that is installed to a device using a CAB file.

The way to do this is to write a special setup DLL and include it in your installation CAB. This support has been around for years, however it's not the easiest thing to find documentation on. A fellow named Girish has posted a nice writeup on how this works over at The Code Project. It's actually the second part of a two part article. The first part is an equally nice writeup of how to create a cab file in the first place.

MSDN also has documentation on setup DLLs and creating cab files, if you need it.

[Author: Neil Enns]