Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > MSI wrapper for .exe setup
 

MSI wrapper for .exe setup

Hi All,

I have anexecutablesetup.exewith a bunch of files accompanying it. What I need to do, is to embed it into a single package (I don't have sources for the other setup project, so I can't simply rebuild that installer into one package). Basically what I need, is a self-extracting archive that launches "setup.exe" after extraction and cleans after itself (I'm aware that my approach violates a bunch of good practices, but single-file installer is a must-have for me).

For nowI'musing an .msi built froma Setup Project in Visual Studio'08:I simplyadded custom actions for install and uninstall which launch setup.exe with appropriate switches. The problem is - now, upon installing, I have 2 entries in "Add/Remove programs", another folder with setup files that are no longer needed, etc.

That's why I'd like to customize my .msi a little to make it a simple wrapper - not exactly a full installer. What I expect of this installer is to:

1) Extract underlying setup.exe (and other needed files) to a temporary location
2) Run setup.exe with the command lineparameters as provided to wrapping MSI (show only a progressbar while extracting, or no GUI at all)
3) Leave no trace in the system(that is: do not create an entry in Add/Remove Programs, remove temporary installation dir and so on.
None of these files would be ever needed, as extracted setup will install to user-selected location and have its own uninstall routines.
In simple words: I'd like the app to cleanly "uninstall" itselfright after installing (only custom action result shall persist).


I've switched to WIX Toolkit, since AFAIK creating such a setup with MS VStudio Setup Project is not possible. What I already have is an GUI-less installer that extracts its content files to temp dir and launches setup.exe as a custom action.


Questions I have:

1. How to pass multiple commandline switches to setup.exe?

2. How to delete destination directory upon execution of setup.exe?.I tried a VBS script (as below) - It's not willing to work ;)

3. What to do to remove any trace of previous install? (for now 2nd run lanuches uninstall, as the wrapper app is already installed - need to clean remaining registry entries etc)



Thanks in advance



Outlineot the wix file I have so far (I've ommited some not relevant elements and attributes):
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product>
    <Package InstallerVersion="200" Compressed="yes" />
    <Media Id="1" Cabinet="MyInstaller.cab" EmbedCab="yes" />
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="TempFolder">
        <Directory Id='INSTALLLOCATION' Name='MyInstaller'>
          <!--COMPONENTS HERE-->
        </Directory>
      </Directory>
    </Directory>
    <Feature Id="ProductFeature" Level="1">
<!--COMPONENT REFS HERE
--> </Feature> <CustomAction Id="LaunchSetup" FileKey="setup.exe" ExeCommand="[SETUPPARAMS]" Execute="immediate" Return="ignore" HideTarget="no" Impersonate="yes" /> <Binary Id='RemoveUnpackDir.vbs' SourceFile='RemoveUnpackDir.vbs' /> <CustomAction Id="RemoveUnpackDir" BinaryKey="RemoveUnpackDir.vbs" VBScriptCall="RemoveUnpackDir" Return="check"/> <InstallExecuteSequence> <Custom Action='LaunchSetup' After='InstallFiles'></Custom> <Custom Action='RemoveUnpackDir' After='LaunchSetup'></Custom> </InstallExecuteSequence> </Product> </Wix>

VBS script to delete target dir (not working :))
'RemoveUnpackDir.vbs script
Function RemoveUnpackDir()
RemoveUnpackDir = 3 Set oFSO = CreateObject("Scripting.FileSystemObject") oFSO.GetFolder(Session.Property("INSTALLLOCATION")).Delete(True) RemoveUnpackDir = 1 'return success End Function
  • Edited bymbronk Wednesday, August 26, 2009 7:20 PM
  • Edited bymbronk Wednesday, August 26, 2009 7:25 PM
  • Edited bymbronk Wednesday, August 26, 2009 7:17 PM
  •  
mbronk  Wednesday, August 26, 2009 7:09 PM
Hi mbronk,

Wix is beyond the support area of Windows Forms forums. It is an open source software which offer support here
http://sourceforge.net/community/forum/

You can post your question to that site.

Also I have found a useful tutorial of Wix and want to share it with you, hope it can benefit you.
http://www.tramontana.co.hu/wix/lesson1.php#1.5

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, August 28, 2009 7:45 AM
Hi Kira,

Thanks for your reply. I wasn't fully aware that WIX is out of scope of this forum - sorry for that.
I've already known the tutorial you are refering to - it is very useful, however doesn't clear all my doubts.

Still - is it possible to wrap something into an msi without usingwix? (in VStudio,Orca...)

Best regards,
Mateusz
mbronk  Saturday, August 29, 2009 10:06 AM
Hi mbronk,

Visual Studio doesn't offer that rich feature than Wix. Once you use Visual Studio, you can write .NET code to do custom action.

Here is the information of custom action.
http://msdn.microsoft.com/en-us/library/d9k65z2d%28VS.80%29.aspx
To use custom action, you should add a Installer class to your project and override the method. Then add it as your custom action in your setup project custom action setting.

If that still cannot meet your need, you may consider to post it to the Wix forum for help.
http://sourceforge.net/community/forum/

If you have any problem with Microsoft product, please feel free to tell me.

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Monday, August 31, 2009 2:26 AM
If you have any problem with Microsoft product, please feel free to tell me.

Sincerely,
Kira Qian

Actually I do, but this is rather beyond the scope of this topic.

Well, I have a soution with multiple projects including a setup project (.vdproj). When I build it via Visual Studio (Build->Build All), whole solution builds just fine, but invoking a build by msbuild.exe (that is - in build server configuration) causes setup project to be skipped (I don't remember the exact error message, but the bottomline is - msbuild does not build a .vdproj when it is a part of multi-project solution).

I've already found a workaround - I've excluded building my setup project from solution andadded yet another project (to preserve dependencies) which does nothing, but invokes msbuild manually for.vdproj onlyas a pre-build event.

Still - this approach is "ugly" for many resons... So the question is: Why oh why can't msbuild just buildwhole solutionfor me?

I'm using Visual Studio 2008 (Team System) + SP1


As for my original question - I've in fact switched with one of my setups to WIX... it still needs some refinement, but at least it does what I expect of it.
BTW. Wix'es build just fine via msbuild - only this .vdproj is stubborn.


Regards,
Mateusz
mbronk  Monday, August 31, 2009 6:18 PM

You can use google to search for other answers

Custom Search

More Threads

• Including files not referenced by the VS project
• Setup Project File Types Editor, Howto specify command as Visual Studio devenv.exe?
• FileNotFound Exception When Closing a Web-Deployed App
• Change Install and Update URL after publishing...
• Clickonce installation stops (fails) without error message
• OS version check launch condition
• Merge module files won't uninstall from Module Retargetable Folder
• Create an 1) installer with .net 2.0 + program files 2) usb run no installation.
• WEBCA_GatherWebSites error on msi built from VS2005 Deployment project
• Multiple Install paths?