Leather is the best material...  Just kidding.  :-)

I have added a project to one of my solutions that generates a bootstrap to
preinstall required pre-requisites.  I thought I would share this with all
of you:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.Tasks.Deployment.ManifestUtilities;
using Microsoft.Build.Tasks.Deployment.Bootstrapper;
using Microsoft.Build.Tasks;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace GenerateBootstrap
{
   class GenerateBootstrap
   {
       static void Main(string[] args)
       {
           GenerateBootstrapper gbs = new GenerateBootstrapper();
           TaskItem SqlBcRuntime;
           TaskItem WseRuntime;
           string PFiles = Environment.GetFolderPath(
Environment.SpecialFolder.ProgramFiles).ToString();

           try
           {
               gbs.ApplicationName = "My Product";
               gbs.ApplicationFile = @"MyInstall.msi";
               SqlBcRuntime = new TaskItem(@"
SQL.2005.Backwards.Compatibility");
               WseRuntime = new TaskItem(@"
Web.Services.Enhancements.2.0.SP2");
               gbs.BootstrapperItems = new ITaskItem[] { SqlBcRuntime,
WseRuntime };
               gbs.Path = PFiles + @"\Microsoft Visual Studio
8\SDK\v2.0\Bootstrapper";
               gbs.ComponentsLocation =
ComponentsLocation.Relative.ToString();
               gbs.CopyComponents = true;
               gbs.OutputPath = @".\output";
               gbs.Execute();
           }

           catch (Exception ex)
           {
               Console.WriteLine(ex.Message);
           }
       }
   }
}


The above code will generate a bootstrap package with a reference to the
required dependencies and my product MSI.  The two dependencies I am using
were packages I created using the Bootstrapper Manifest Generator available
here:
http://www.codeplex.com/bmg

I call this compiled executable as a post-build task to create the
bootstrap.  If there are any questions, let me know.  Hopefully, someone
else will find this useful

Regards,
//aj
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to