[MS]Building a Bootstrapper via command line


Alright, so you want to use the Generic Bootstrapper to deploy your application but for one reason or another you aren’t using ClickOnce or a SetupProject.  (You are developing a VC++ app with a custom installer, for example).  Well, unfortunately there is no designer support ouf of the box but you still can create a Bootstrapper for your application.  How?


The same way Visual Studio does, MSBuild of course!


There is no magic to creating a Bootstrapper, it is just an MSBuild target which ClickOnce and SetupProjects call for you.  However, you don’t have to leave all the Bootstrappin’ fun to Visual Studio.  Below is an example MSBuild file for creating a Generic Bootstrapper:


<Project xmlns=http://schemas.microsoft.com/developer/msbuild/2003>
   <
ItemGroup>
      <!– Include the ‘Product Code’ for every package you want –>
      <
BootstrapperFile Include=“Microsoft.Net.Framework.2.0”>
      
</BootstrapperFile>
   
</
ItemGroup>

   
<
Target Name=Bootstrapper>
      
<
GenerateBootstrapper 
         
ApplicationName=My Awesome Application 
         
ApplicationFile=MyApp.exe
         BootstrapperItems=@(BootstrapperFile) 
         Culture=en 
         CopyComponents=True 
         OutputPath=D:\CustomBootstrapper\ />
   
</
Target>
</
Project>


That’s it!  Now save that XML to a file, “CLI Bootstrapper Test.xml” for example, and on the command type:


MSBuild “CLI Bootstrapper Test.xml”


MSBuild will parse your target file, do a little magic, and *POOF* your very own private Bootstrapper.

[This is provided “AS IS” with no warranties, and confers no rights. Use of included script samples are subject to the terms specified in the Terms of Use.]


 

Comments (5)

  1. Link Listing – June 29, 2005

  2. ChrSmith says:

    Question from [Jake Ashcraft]

    In your post on creating a bootstrap from the

    command line, how can I specify that it should place the dotnetfx.exe in

    the output directory?

    Answer from [Yours Truly]

    The reason the file isn’t being copied to the output directory is that it that the default value for PackageDeploymentMethod is ‘HomeSite’. (Where each package file is downloaded from its own, specified location on the internet.)

    To patch this, add the following attribute to the Bootstrapper target:

    ComponentsLocation="Relative"

    This will choose ‘SameSite’ as the PackageDeploymentMethod (that is relative to setup.exe). Other options are:

    ComponentsLocation="HomeSite"

    or

    ComponentsLocation="Absolute"

    (which indicates you want to use the ComponentsURL)

  3. How to create a Bootstrapper to launch an EXE file

  4. Martin Hueser says:

    How can I tell the Generatebootstrapper task where to look for packages, e.g. to add an own package?

  5. ko says:

    is there a way to have the bootstrapper remember the app has been installed?  If i run the setup.exe and then run the .application file directly, it seems to not know it was already installed…