Adding MS Chart Controls as a prerequisite in your Visual Studio 2008 installation package.

In order to specify a prerequisite to your deployment package something called a bootstrapper is needed. Unfortunately Microsoft do not provide a bootstrapper for the Chart Controls for the .Net Framework.

Luckily it is not too difficult to create your own bootstrapper.

Here's how to do it:

Firstly you need to locate the folder in which the bootstrapper files need to be. On my machine this is here: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\

Now you can either download the files that I have put together here and extract the contents of the zip file into this folder, or follow the instructions below to create the files yourself.

The zip file contains all the files required including the full MS Chart controls installation package, which you probably already have. So you may find it simpler to create the files yourself.

  1. Create a Folder called: Microsoft Chart Controls
  2. In this new folder create a file called product.xml
  3. Use Notepad to edit this file and add the following code:
    <?xml version="1.0" encoding="utf-8" ?> 
    <!-- Bootstrapper for MS Chart Controls. Created by Phil Preen, Feb 2009, use at your own risk -->
    <Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.ChartControls">
    <RelatedProducts>
    <DependsOnProduct Code="Microsoft.Net.Framework.3.5.SP1" /> 
    </RelatedProducts>
    <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="MSChart.exe" HomeSite="MSChart.exe" /> 
    </PackageFiles>
    <InstallChecks /> 
    <Commands>
    <Command PackageFile="MSChart.exe">
    <ExitCodes>
    <DefaultExitCode Result="Success" /> 
    </ExitCodes>
    </Command>
    </Commands>
    </Product>
    
  4. Copy MSChart.exe (the chart controls installation package) into this folder.
  5. Create a sub-folder called: en
  6. In this new folder create a file called package.xml
  7. Use Notepad to edit this file and add the following code:
    
    <?xml version="1.0" encoding="utf-8" ?>
    <!-- Bootstrapper for MS Chart Controls. Created by Phil Preen, Feb 2009, use at your own risk -->
    <Package
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      Name="DisplayName"
      Culture="Culture"
      LicenseAgreement="eula.rtf"
    >
        <PackageFiles>
            <PackageFile Name="eula.rtf"/>
        </PackageFiles>
        <!-- Defines a localizable string table for error messages-->
        <Strings>
            <String Name="DisplayName">Microsoft Chart Controls for Dotnet Framework 3.5 SP1</String>
            <String Name="Culture">en</String>
            <String Name="AdminRequired">Administrator permissions are required to install Microsoft Chart Controls for Dotnet Framework 3.5 SP1. Contact your administrator.</String>
            <String Name="AnotherInstanceRunning">Another instance of setup is already running. The running instance must complete before this setup can proceed.</String>
            <String Name="GeneralFailure">A failure occurred attempting to install Microsoft Chart Controls for Dotnet Framework 3.5 SP1.</String>
        </Strings>
    </Package>
    
  8. Copy eula.rtf (the chart controls license agreement) into this folder. To obtain this file, start the Chart Controls installer and choose the option to Save the license agreement.

Microsoft Chart Controls will now appear in the list of prerequisites in your Visual Studio deployment settings.

Note that because Microsoft Chart Controls is dependant upon the .Net Framework 3.5 SP1. It is necessary to have the Framework files available. See the instructions in the Visual Studio 2008 SP1 readme file here (see Section 2.3.1.1).