Less MSIérables: A tool to Extract the contents of an .msi File

I'm not a fan of Microsoft's .msi installer files. They're slow, they don't let me pick start menu groups, and they are a major overkill for lots of tiny program installations that I use where a simple rar file (okay zip would work too) would be much more suitable. So sometime last year I spent a night hacking together a simple tool that lets me take these miserable .msi files and extract their contents. Since others may find it useful too, I figured I'd put it out here.

It works from the command line, has a simple form that lets you extract files and view msi tables. Let me warn you the first time you run it, it will add an "Extract" item to the right-click menu in explorer when right-clicking on .msi files (the added registry entry is made at \\\Registry\HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\command\). Thanks to the WiX project for the handy utility classes for working with msi files and awesome reference on msi internals.

Screenshot of Less MSIérables: A tool to Extract the contents of an .msi File
You can run it from the command line using the syntax:
lessmsi -x <inputfile> <output directory>

Example:
lessmsi -x "C:\Downloads\ActiveReports for .NET Setup.msi" C:\junk\

2005-Jun-11: Updated to work on .NET v1.1 framework.

2005-Nov-15: Updated with new features & fixes.

You can download it at here and consider it licensed under Common Public License Version 1.0.

posted @ Thursday, June 02, 2005 1:09 AM

Print

Comments on this entry:

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Luc at 6/3/2005 12:11 AM

Wow, very slick little tool! Quite nicely done I might add too. :) Thanks for sharing!

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Anonymouse at 6/10/2005 7:16 AM

Hi, me and my friend tried to use this tool after installing .NET framework 2.0 beta, which seems to be required as it doesn't run on 1.1 with us.

Whenever we try to open an .MSI package, we receive the following error:

"ERROR:Failed to open file. n files found"

Any idea what could be the cause of this? We both run Windows XP.

Thanks

# Less MSI

Left by overflow at 6/11/2005 7:12 PM

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Scott Willeke at 6/11/2005 8:36 PM

The problems should be resolved with the latest one now. Download it at the updated link above. Sorry about the confusion!

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Anonymouse at 6/13/2005 4:29 AM

Excellent all works now!!!!!!

Only feedback i have: create a Deselect All and Select All button ;)

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Loke Kit Kai at 6/29/2005 5:20 AM

I also wish for a deselect all and select all button too

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Loke Kit Kai at 6/29/2005 5:27 AM

Had an exception. Pasted below...

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: '13' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'.
at System.Windows.Forms.ProgressBar.set_Value(Int32 value)
at Willeke.Scott.LessMSIerables.ExtractionProgressDialog.UpdateProgress(ExtractionProgress progress)
at Willeke.Scott.LessMSIerables.ExtractionProgressDialog.UpdateProgress(IAsyncResult result)
at Willeke.Scott.LessMSIerables.ExtractionProgress.ReportProgress(ExtractionActivity activity, String currentFileName, Int32 filesExtractedSoFar)
at Willeke.Scott.LessMSIerables.Wixtracts.ExtractFiles(FileInfo msi, DirectoryInfo outputDir, MsiFile[] filesToExtract, AsyncCallback progressCallback)
at Willeke.Scott.LessMSIerables.MainForm.btnExtract_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
lessmsi
Assembly Version: 1.0.1988.32288
Win32 Version: 1.0.1988.32288
CodeBase: file:///E:/Development%20Resources/Sharepoint/Lessmsierables-20050611/LessMSIerables/lessmsi.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
wix
Assembly Version: 2.0.2110.0
Win32 Version: 2.0.2110.0
CodeBase: file:///E:/Development%20Resources/Sharepoint/Lessmsierables-20050611/LessMSIerables/wix.DLL
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.


# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Bâshrat the Sneaky at 7/23/2005 2:36 PM

Thanks alot! I'll try it in a moment.

Why hasn't there always been such an application???!!!

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Bâshrat the Sneaky at 7/23/2005 2:41 PM

Too bad... it did not work, or at least not with [url=http://cdrom.amd.com/21860/updates/opteron_drivers/english/driverpack32.exe]this[/url] MSI installer.

It only gives the files necessary for the MSI setup; I can do this with 7-zip too...

Any clue what's going wrong?

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Luc at 7/25/2005 4:38 PM

Uh oh... what have you started here Scott? :)

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by overflow at 7/25/2005 5:05 PM

Bâshrat driverpack32.exe is not an msi file. I Used WinRAR to extract it, and other than a couple dll's (which are presumebly the drivers you're looking for) there only appeared to be an installer to install windows installer itself.

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by overflow at 7/25/2005 5:06 PM

PPL: If you have problems please tell me the msi file you had problems with so I can try to reproduce to fix it.

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Tom at 7/28/2005 12:06 PM

When I run the program I do not see the scroll bars or the Extract button. This is probably because I am using large (120 dpi) fonts, which can alter the placement of UI controls. Also, after launching the program in GUI mode from the command prompt, ideally the command prompt would return immediately. Currently, the command prompt returns only after exiting the application.

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by FeuerFrei at 8/9/2005 5:41 AM

Hi and well done for this tool !!

A bout the crash, there is a bug here :

_progressBar.Minimum = 0;
_progressBar.Maximum = progress.TotalFileCount;
_progressBar.Value = progress.FilesExtractedSoFar;

If you uncheck a file to be extracted then _progressBar.Value > _progressBar.Maximum --> crash

System.ArgumentException: '13' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'.

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by FeuerFrei at 8/9/2005 9:02 AM

Re,

I think there is a crash here :

public static void ExtractFiles(FileInfo msi, DirectoryInfo outputDir)
{
ExtractFiles(msi, outputDir, null, null);
}

[...]

ExtractionProgress progress = new ExtractionProgress(progressCallback, filesToExtract.Length);

If filesToExtract == null then filesToExtract.Length crashes

# Posted to the SMS email discussion list...

Left by Rod Trent at myITforum.com at 8/12/2005 12:42 PM

# Re: Everything

Left by David Leek at 9/22/2005 12:51 PM

Excellent - worked first time for me. And helped solve a problem I would have otherwise gone potty about.

Thanks!

# New Version of MSI File Extraction

Left by overflow at 11/16/2005 2:34 AM

# Microsoft Stand-Alone Device Emulator CTP

Left by Ken Lince - Partner Technology S at 11/28/2005 11:21 PM

I've been on the road quite a bit lately and doing a lot of talking about Exchange SP2 and all the great...

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Rachit at 12/19/2005 4:43 AM

Good

# Might be an idea...

Left by GotenXiao at 12/21/2005 8:00 PM

...to not require .NET >.>

Sorry, but any application that doesn't come with the DLLs neccesary to run it, or requires the installation of a 100+MB framework is gone off my system before you can say "Microsoft sucks".

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Scott Willeke at 12/23/2005 2:23 AM

GotenXiao:
Firstly, I hate the fact that C# and the base class libraries have to be used with the "all or nothing" .NET runtime and framework and would love to have a real linker that would link the minimum set of dependencies from the framework into a standalone executable (I have <a href="http://blogs.pingpoet.com/overflow/archive/2004/02/21/383.aspx">said all this before</a>). However, in all fairness, the .NET Framework (v1.1 anyway) is something like 22MB (not 100+), and there are non-Microsoft alternatives such as Novell's mono Project (www.mono-project.com). However, if you you're so adamant that "microsoft sucks", why run windows (and therefore have any .msi files) at all (seriously)?

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Sérgio at 1/18/2006 6:26 PM

I had a problem to run this program, was show: Aplication Error (0xc0000135). Press ok to close.

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by l00nytoons at 2/7/2006 3:06 PM

Fantastic program! Thanks for taking the time to write it and for making it free too!

# Extract the content of a .MSI file

Left by STEFANO DEMILIANI WeBlog at 2/8/2006 5:30 PM

# Extract Contents from MSI Files

Left by Thomas Williams at 2/8/2006 9:25 PM

I wrote ranted some time back, in relation to having sample code come wrapped up in an MSI package: ...

# Extracting stuff out of MSI files

Left by Tate's Blog at 2/9/2006 7:24 PM

# thanks

Left by Jon Wright at 3/16/2006 2:03 AM

Thanks for this. It saved me some messing around today.

I also think it would benefit from select/deselect all buttons. And sorting columns. And using folder info for extracting. The last suggestion sounds a bit ridiculous but seriously I think it would be useful to do this in some rough and ready way.

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Scott Willeke at 3/16/2006 4:53 AM

The latest version has all of those features. Check it out at the article
New Version of MSI File Extraction & Viewer Utility. Let me know if I'm missing something.

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Brad Hadden at 3/31/2006 6:06 PM

Downloaded the source, built it, ran it, looked at an msi file that I had some questions about. Sweet!

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Diego at 4/2/2006 1:12 PM

Hi, just a bit confusion. From the link:
http://blogs.pingpoet.com/overflow/pubfiles/lessmsierables-20051110.zip

I still get a console application either in binary or from the C# source.

I cannot get the WinForm application GUI.

Why?

Thanks.

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Scott Willeke at 4/9/2006 7:31 PM

Diego: I just tried it from that link and it works. Note that it is starting as a console application, but if no arguments are specified immediately opens up a windows form.

# re: Less MSI&eacute;rables: A tool to Extract the contents of an .msi File

Left by Eeyan at 7/10/2005 4:05 PM

Ability to sort columns would be great in the next version :)

Comments have been closed on this topic.