ISWIX, LLC View Christopher Painter's profile on LinkedIn profile for Christopher Painter at Stack Overflow, Q&A for professional and enthusiast programmers

March 14, 2011

Guess What Else InstallShield Can Do!

Flexera's InstallTalk blog recently posted a blog articled titled `I Didn't Know InstallShield Could Do That?` I mainly reference the article not for the content but to use it as a hook for a more interesting albeit darker version:

InstallShield can be used a bootstrapper for a WiX MSI.

...evil laugh...

It's simple.  InstallShield 2011 Premiere has some new features that allow you to inject custom commands at various stages of the build process.  One of these steps is the Precompression Event.  This event occurs right after the MSI has been built but not yet digitally signed.   This allows you to do custom post build processing of the MSI without breaking it's digital signature. 

InstallShield's handling of Setup Prerequisites ( the kind that run before you MSI ) it's fairly loosely coupled from the MSI.  Feature prerequisites are a bit more complicated but not impossible to reproduce.   Let's look at the work flow.

1) Create a Basic MSI project ( call it anything you want ) and then give it a feature and a component.

2) Add the .NET 3.5 SP1 setup prerequisite using the redistributables view.   Right click and select properties and type in a release flag of DOTNETFRAME35SP1.

3) Create use the Release Wizard to generate a new Product Configuration and Release.  Pick a compressed network image with setup.exe.

4) Set ProductName, ProductVersion, PackageCode, ProductCode and UpgradeCode to the same values as in your WiX msi.  Set the Generate Package Code value to false and set the MSI Package File Name field to be the same as your WiX msi ( without the .msi part ).

5) Copy your WiX MSI to the location specified as under Path Variables.

6) On the Build Events tab of the release paste in the following precompression command

cmd /c copy "<ISPROJECTDIR>\WiX35.msi" "<ISPROJECTDIR>\WiX35\Release 1\DiskImages\DISK1"

March 12, 2011

Redemption of Visual Studio Deployment Projects

For years I've spoken of the horrors of Visual Studio Deployment Projects:

  • Every file and every registry key is always a key file of it's own component
  • ShortCuts are always advertised
  • Dependency Scanning is next to impossible to disable
  • Custom Action support is horrible  ( deferred only )
  • No support for MSI concepts such as ServiceInstall encourages Custom Action anti-patterns
  • Many more ( Rob Mesnching has an blog post out there somewhere with 100 comments of people's compaints about VDPROJ and support of Windows Installer XML.
The loathing of VDPROJ was so great that Microsoft is replacing it with InstallShield 2010 Limited Edition.  Now I'm going to say something that shook my world view to it's foundation:

-gulp-

Visual Studio Deployment projects, used in a very specific way, is....

-gulp-

pretty useful.

-exhale-

Wow, there, I said it.   Go ahead, get your laughs of disbelieve out.   I know, I know, Chris has finally fallen off of his rocker.   OK, you ready for my defense?  Here goes:

I came to realize with  my 'all component data goes in merge modules' using IsWiX and WiX that essentially every single complaint that I had about VDPROJ stemmed from how it authored component data and exposed custom actions.    By abstracting all of this into WiX merge modules and leaving next to nothing in the VDPROJ installer project  I am able to build an installer that passes ICE validation and presents no garbage that causes concern for me.

 Sure, it's a fairly limited solution but for a great many projects it's probably actually is good enough.   I get a UI that can be somewhat customized without diving too deep into the details, a bootstrapper that can handle basic prereqs like .NET 3.5/4.0, SQL Compact, C++ runtimes,  the ability to define System Searches and Launch Conditions and support for Major Upgrades.

As long as I use a discriminating eye and void using VDPROJ to do anything else like define files and folders, shortcuts, registry and so on, it's really no that bad.

Instead I use the merge module for everything.   Need to author 1,000 files?  No problem, just drag and drop in IsWiX and it's done.    Need to give a few of those files shortcuts in the start menu?   No problem, write a few Directory, ShortCut and Icon elements and that's done.   Need a Windows Service?  No problem, ServiceInstall and ServiceControl elements.   Create a Service Account?  Configure the Firewall?  Find the Visual Studio ItemsTemplates directory?  Check, Check, Check.

Sure, I'm going to be limited to one feature ( which makes variation points difficult and resiliency repairs intensive ) and I won't be able to do quiet a bit of customization but some people probably don't really need this anyways.

It's like going to one of those 120+ item buffets at the beach when you are on vacation.  If you ignore those 100+ items that junk and stick to the 10-20 items that are good and then bring a few of your favorite adult beverages from home, you'll probably have a pretty good time on the cheap.    I know, bad analogy but I hope it gets the point across.

So there you have it.  A somewhat cautious yet positive endorsement for the use of VDPROJ.  Who would have thought it?

March 10, 2011

Installation Collaboration Workflows using Free Tools

Recently I was asked to explain the workflow for Industrial Strenth Windows Installer XML (IsWiX).  In a nutshell IsWiX is all about enabling collaboration by enlisting the help of various contributors in defining the contents of the installer.  This is done through the use of Microsoft Merge Modules.   We use MSM's rather then fragments and libraries because the intent is to interop with other tools such as InstallShield 2011.

At my day job,  Visual Studio is included in the standard developer image which pretty much everyone in Engineering gets.  Recently I was doing some work for a client when it became clear that the person who could best contribute to the project wasn't a developer and didn't have Visual Studio.    While VS is not strictly required by IsWiX it really does help.   So I started looking for a solution to the problem of a non-developer persona contributing to Setup and I came across the following:

Microsoft offers a free, redistributable download: Microsoft Visual Studio 2010 Shell (Integrated) Redistributable Package ( Installs .NET 4.0 )

 This installer basically gives you a stripped down Visual Studio IDE with most tools and languages missing.  It just happens that Windows Installer XML 3.5 supports this shell.  ( As an aside, WiX 3.0 supports the 2008 version of the shell. )  Finally, IsWiX (Requires .NET 3.5 SP1) also supports this shell.   So after downloading these three/four packages on an XP SP3 image we suddenly have a fully functioning IDE for authoring merge modules.

Now let's go through the workflow.

1) Start Visual Studio 2010
2) Select  File | New Project


3) Select Merge Module Project and pick a location and project name followed by OK. 

4) After the project is created and shown in solution explorer, rename the MergeModule.wxs to the "[project].wxs". (It'll work if you don't know this but it really gets annoying having dozens of wxs files with the same name. 

5) Remove the TODO Create Component comments and save the WXS file.


At this point we are really just doing standard WiX stuff. Now let's go play with IsWiX.


6)  Select Tools | IsWiXAddIn ( The one with the cheesy looking smiley face. )



The first screen to come up in IsWiX is the General Information designer.  This is where we can view and edit information related to the ModuleSignature and ModuleDependency tables. ( Wix, Package and Dependency elements in WiX speak. )

7) Click on the Files and Folders Designer


The files and folders designer is where you can define the say which source files get installed where.  In WiX this will be your Directory, Component and File Elements.   If you look closely you'll see it's only letting you pick files from where the wixproj and wxs files are.  This is because by default the designer orientates itself to the current directory.  Let's change it to C:\

8) Click on the Code View Tab


Notice that IsWiX has authored a special preprocessor variable called SourceDir and assigned it a value of '.'.   Let's change that line to read  .... SourceDir="..\..\.." ( the number of ..'s will depend on where you put your wxs file or you can just point it to some other directory if you'd like. )  Now let's go watch the effect:

9) Click on the Designer View tab


Note the source files view now points to C:\.   Let's author some files and folders into our merge module.

10)  Drag a folder from the Source Files directory tree to the MergeRedirectFolder node on the destination folders tree.


Now we can see the directories / subdirectories and files shown in the destination.  Let's send these changes back to visual studio.

11)  Click the save button and close IsWiX.



At this point Visual Studio will notice that the contents of our wxs file has changed and ask if you want to reload it.

12) Click Yes


From here we can see the XML that IsWiX authored for us.  We can now rebuild the project to verify that the module builds.

13) Right click the merge module project in the solution view and select Rebuild.

By now it should be obvious that IsWiX can allow non-developers to author merge modules.  But WiX developers can also edit the raw XML by hand and add in additional elements such as ServiceInstall, ServiceControl, ShortCut,  ProgId and so on.   Most edits by hand will have no effect on IsWiX.  Eventually it's hoped to write additional designers that can automate all of these elements.

The other point I'd like to make is the workflow that I use this with

1) Meet with subject area experts ( Dev, Web, Docs, DBAs et al ) and have a dialog where we provide them a basic understanding of Installers and they provide us a basic understanding of the design of their solutions.

2) Come to an agreement on how their solution breaks down into Feature and Merge Modules.   Implement the feature tree in the installation tool of your choice ( InstallShield 2011 for me )  and do the initial setup of the merge module solution.

3) Inform the developers that it's now their job to keep the modules up to date and that we are available to assist / answer question and do additional meta markup such as services and COM.

So there it is in a nutshell.  How I do collaboration using IsWiX / WiX and InstallShield.   If your needs are limited you could use WiX or InstallShield 2010 Limited Edition and have a complete system with nothing but free tools.

Any questions?

PS-  Just for fun I decided to try to install InstallShield 2010LE on the Visual Studio 2010 Shell.  It kind of worked.   It did install and I could open an existing ISL project but the ability to create a new LE project from the File menu was missing.   This isn't important to the Collaboration discussion I mentioned above because I would expect the Setup developer supporting all of this would either have WiX, InstallShield Profesional or Visual Studio and InstallShield LE.



March 06, 2011

.NET Reflector is Priceless

Recently, thanks to the Big Swinging Developer, I was given a license of .NET Reflector.

I just wanted to say that Reflector really is priceless!

Just today I was working on a new install for a remote customer and wouldn't you know it, the application threw a null object reference exception when I tried to start it!

I didn't have any sources or symbols so I could have thrown in the towel right there.

Instead I used Reflector to export the assembly to a CSPROJ and rebuilt it so I could have my own symbols and source code. Before I could say "Big Swinging (Install) Developer" I was stepping through the code and found the source of the problem.

So instead of having the usual "works on my machine"discussion that so often accompanys integration I had the remote developer fixing the problem.

Priceless!  Thanks redgate, Red-Gate or Red Gate. ( Not sure how it should be spelled! )

March 04, 2011

InstallShield Setup Prereq for Microsoft SQL CE 3.5 SP2 Bug Alert

I was recently working on an InstallShield 2011 ( Hotfix A ) Basic MSI project and I needed to add the Microsoft SQL CE 3.5 SP2 prereqs to my project.  In doing so I've noticed a big problem:

1) InstallShield only provides a PRQ for the x86 redist not the x64 redist.
2) The PRQ provided for the x86 redist incorrectly filters out 64bit Windows Server 2003, Windows Vista and Server 2008 while correctly installing on 64bit Windows 7.

Per Microsoft, the following operating systems should be supported:

Supported Operating Systems:Windows 7;Windows Server 2003 R2 (32-Bit x86);Windows Server 2003 R2 x64 editions;Windows Server 2003 Service Pack 2;Windows Server 2003 Service Pack 2 x64 Edition;Windows Server 2008 R2;Windows Server 2008 Service Pack 2;Windows Vista Service Pack 2;Windows XP Service Pack 3


Also of note is that you must install both the x86 and x64 configurations on a 64bit edition of Windows:
 
On a 64-bit Computer, install both the 32-bit and the 64-bit version of the SQL Server Compact 3.5 SP2 MSI files. Existing SQL Server Compact 3.5 applications may fail if only the 32-bit version of the MSI file is installed on the 64-bit computer. Developers should chain both the 32-bit and the 64-bit MSI files with their applications and install both of them on the 64-bit Computer. Refer to the KB article or to the Install.txt file that is extracted with the MSI files for more information.


My guess is that is an allusion to yet more Bitness pain that I previously covered.  Depending on whether your .NET EXE is compiled for x86, x64 or AnyCPU and what version of Windows you are running on it may need one version of the redist or the other version therefore both must be installed.