Modifying package deployment method via command line


So as mentioned previously there are three ways to deploy Bootstrapper prequisites.  Just to review:


SameSite – They exist on the same URL as the Bootstrapper
HomeSite – Packages are downloaded from their own vendor’s websites
ComponentsURL – All packages are downloaded from a seperate URL


Did you know that you can configure which method the Bootstrapper will use after the Bootstrapper has been built?  The Bootstrapper supports modification of how it will obtain package files via the command line.  Before I can go into how to change it, let me first supply some pseudo code for how the Bootstrapper chooses where to download packages from.


// pkg.RelativePath = “dotnetfx\dotnetfx.exe”
foreach (PackageFile pkg in packagesToDownload)
{
   
if (m_useHomeSite == true)
   
{
      
if (pkg.HomeSiteURL != null)
         
Download(pkg, pkg.HomeSiteURL);
      
else
         
Download(pkg, m_applicationURL + pkg.RelativePath);
   }
   
else
   
{
      
if (m_componentsURL != null)
         
Download(pkg, m_componentsURL + pkg.RelativePath);
      
else
         Download(pkg, m_applicationURL + pkg.RelativePath);
   }
}


The ApplicationURL can be thought of as the ‘working directory’ for the Bootstrapper, except it is burned in at build time.  (Because if setup.exe is launched from a web the official working directory will be the IE cache.)  This property is automatically set by ClickOnce deployments and is equal to the ClickOnce InstallationURL.


So if SameSite is chosen, then HomeSite is false and the ComponentsURL is not set.  This way all packages are downloaded relative to the ApplicationURL.  Selecting ComponentsURL as the package deployment method however means that all packages are downloaded relative to that seperate, ComponentsURL.  HomeSite means use the package’s HomeSite if available otherwise use SameSite (ApplicationURL).


Now that you know how the ApplicationURL, ComponentsURL, and HomeSite values are used by the Bootstrapper, we can begin setting them via the command line.


To set the ApplicationURL:
setup.exe -url=<new application url>


To set the ComponentsURL:
setup.exe -componentsurl=<new components url>


To set the HomeSite flag:
setup.exe -homesite=<true / false>


Note that you can also check the current values by typing:
setup.exe -url


The only caveat is that if you change the HomeSite, ComponentsURL, or ApplicationURL via the command line the Bootstrapper will modify itself.  Meaning that any existing authenticode signature will be invalidated.  So don’t alter the Bootstrapper on the command line unless absolutely nessecary.

Comments (2)

  1. Bob C says:

    Changing via the -homesite=false doesn’t seem to work with VS2005 RC installers.

  2. Bob C says:

    I’m getting the following error if I have Office2003PIA as a prerequsit and use the "Download Prerequisits from this location" option , any ideas?

    Error 4 The install location for prerequisites has not been set to ‘component vendor’s web site’ and the file ‘O2003PIAO2003PIA.exe’ in item ‘Microsoft Office 2003 PIA Redistributable’ can not be located on disk. See Help for more information. C:Documents and SettingsBobxMy DocumentsVisual Studio 2005ProjectsMJ_Outlook_EntContactsMJ_Outlook_EntContactsSetupMJ_Outlook_EntContactsSetup MJ_Outlook_EntContactsSetup