Home
About
Contact
Thursday, September 04, 2008

This is my first post in my WiX and DTF series for WiX 3.0. Here are some others I’ve written:

Windows Installer XML (WiX)

The version of WiX I'm going to talk about is v.3.0, currently in beta. In essence WiX is an XML format for writing MSI deployment packages. Much like using InstallShield or Wise to write your installations, you can use WiX to do the same. So why do you want to use XML to author your msi's? At first I thought: "Ohhh no! Not another XML based authoring tool!" But after doing some more digging, this is one of the scenarios were XML makes sense... kind of. Here's the benefits I see with WiX compared to traditional MSI tools:

  • It's perfect for "code" generation, using Nant, TFS etc.
  • WiX is very clean, so it gives you the possibility to author exactly what you need and not have all the general stuff that IS and Wise has pre added to your installation

Another thing to note is that WiX is open source and it comes from Microsoft (yea, Microsoft HAVE open source projects). Not only that, but this tool got so popular within Microsoft that most of their packages are now moving towards using WiX, and many of them, like Office, already use WiX. That says a lot!

I'll get back to using WiX to author msi installations in a later post, but now I want to focus on DTF and how to use it without WiX.

Deployment Tools Foundation (DTF)

DTF is among other things a managed (.net) wrapper on top of msi.dll (the windows installer library). DTF makes it possible to write custom actions (CA's) for MSI installations in C#, VB.net or any other .Net language. If you're not used to working with MSI installations this might not be a big deal for you, but for me this is fantastic news! Not only that, debugging has now become much easier (or should i say possible).

Before you only had three options for writing CA's: C++, VB Script and Java Script. CA's are custom code you write because there are currently no existing action supported by MS Installer that does what you're looking for.

Examples of things you can do with Windows Installer out of the box are:

  • Install/delete/move files
  • Create/delete/change folders
  • Create/delete/change shortcuts
  • Install/remove/start/stop Windows Services
  • Reboots
  • Install/remove ODBC drivers
  • Register/un-register COM/COM+ applications
  • Register/un-register fonts
  • Write/change registry
  • ...and so on...

Check this out for a more complete list.

However, Windows Installer can't cover all scenarios, so then you turn to CA's. Here are some examples I've used CA's for:

  • List SQL Servers
  • List IIS Web Sites
  • Create Web Sites and Virtual Directories
  • Change XML files

You should however know this; writing good CA's is difficult and there is a lot of things to take into account. For instance, what happens if your installation fails and starts rolling back? Then you need to make sure that any changes you've done to the system with your CA also needs to roll back, meaning you have to have two CA's, one for adding stuff and one for removing stuff.

Why not just stick to VB/Java script?

Using VB and Java scripts has become more and more difficult because of security restrictions, virus programs etc. Many virus programs will not allow you to use Windows Scripting Host (WSH) at all.

About 2 months ago I did some work on our existing msi packages related to a Microsoft certification program. The requirements for this certification forced me to adopt the best practices that I should have done a long time ago. To avoid the problem with scripting I had two options. Rewrite my CA's in C++, or in C# using DTF. After digging around it was an easy choice. I went for managed code.

However, this might not be the right solution for you. Managed code require the .Net framework, so if you don't know if .Net is present on the computer running your software, you might want to stick to "traditional" CA's. For me this was not a problem, since all computers (clients and servers) we install on already have .Net pre-installed.

Next

Next time I'll show you how to create a CA for listing available IIS Web Sites on IIS7. This will allow you to choose which web site to install your application under. Until then I suggest you check out WiX/DTF and start thinking if this is something for you.

.Net | Deployment | Tools | WiX
Saturday, September 13, 2008 12:42:14 AM (W. Europe Daylight Time, UTC+02:00)
Hi Jon,

WIX is cool ehh? I done some projects with it before and if I ever (I know I will) need an installer I'll definitely use WIX for that. Its great for automated stuff. Not related to WIX, but automatically generating your ClickOnce installer is also a very cool thing. If you are interested in some NAnt XML for that drop me a line.

I never tried WIX for setting up IIS so I am looking forward to your next post about that.

-Mark
Saturday, September 13, 2008 1:20:26 AM (W. Europe Daylight Time, UTC+02:00)
Yea, I like it! Looks like a was a bit too fast on my WiX topic predictions though. I think I'll run with the Using WiX to author MSI installations first. Makes more sense. To me at least. Soon finished with that one, and the others will follow quite rapidly after that.
Saturday, September 13, 2008 1:24:42 AM (W. Europe Daylight Time, UTC+02:00)
Mark,

Forgot to comment about the ClickOnce part :) I've actually created the same thing @ Contiki using Nant. It runs with the nightly build, so that there is a new clickonce client deployed for everyone to use in the morning. Works great.
Thursday, September 25, 2008 1:29:54 PM (W. Europe Daylight Time, UTC+02:00)
Hi Jon Arild

I'm looking into using WiX at the current project I'm working on and my gut feeling says that it the right tool for this job. You told my on Twitter that you were working on a post about WiX, how is it going? I'm looking forward to this post , you know! :)

Cheers

Gøran
Thursday, September 25, 2008 3:30:11 PM (W. Europe Daylight Time, UTC+02:00)
Gøran,

I'm almost finished :-) I'm on paternity leave at the moment and it's funny how little time is left for stuff like this. However, tonight or tomorrow you will find a how-to for creating a basic msi with custom UI and an explanation of how to accomplish the most common things in WiX.
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview
RSS RSS - Comments Twitter LinkedIn
         
SEARCH
 
 
         
TOP POSTS
   
         
NAVIGATION
   
         
CATEGORIES
  .Net (61) ADFS (3) Agile (30) Ajax (5) Architecture (20) Articles (1) ASP.NET (6) ASP.NET-MVC (1) Blogging (12) Books (2) BPEL (1) CleanCode (1) CloudComputing (7) Community (4) CSharp (11) DasBlog (5) Database (2) DDD (5) Deployment (16) DSL (1) Events (38) ExtremeProgramming (6) Fun (6) Gadgets (4) IIS (10) InfoQ (4) Java (2) Lean (3) Linq (2) MemoryLeaks (5) Microsoft (37) MVC (1) NDC (2) NNUG (36) Other (10) Patterns (9) Performance (3) Scrum (17) Security (7) ServiceBus (1) Silverlight (4) Software (19) TeamManagement (11) TechEd (7) Testing (4) Tools (25) TvGuide (1) WCF (8) Web (15) WebDeploy (1) WIF (3) Windows (10) Vista (15) VisualStudio (16) WiX (9) Work (16) Workflow (3)  
         
ARCHIVE
   
         
BLOGROLL
   
         
ON THIS PAGE...