There are some cases in which you do not have to create a package for your redistributable. Typically, you only have to build packages for shared components or system components, which have to install files to the GAC, perform global registration, or make up a Windows Service.
You should ask the control provider whether you can ship the redistributable file together with the application. If a simple copy operation would be sufficient to redistribute the prerequisite component (for example, if it has no dependencies), you do not have to create a package. Just make sure that the file is included in the setup or that it is set to Copy Local. (The file's Copy property in Properties View should be set to True.)
You should also determine whether you have to use an installer. If so, use a Bootstrapper package.
To create a new component package, you have to supply:
-
The redistributable component in the form of an EXE or MSI file.
-
The product manifest, product.xml, which contains any language-neutral metadata for the package. This contains metadata common to all the localized versions of the redistributable component.
-
The package manifest, package.xml, which contains language-specific metadata; it typically contains localized error messages. A component must have at least one package manifest for each localized version of that component.
You must create the manifest files by hand, and the metadata they contain must adhere to a specific schema as described by the Package Schema Elements included in the Windows Software Development Kit (SDK). See Product and Package Schema Reference for the schema reference. The setup builder integrated with Visual Studio will validate the manifest files at build time.
You specify dependencies between packages in these manifests by using the DependsOnProduct schema element.
You must then copy the product and package manifest files, together with your redistributable files, into a special folder that Visual Studio has reserved for redistributables packages:
\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages
To write an installer that copies a redistributable component and its manifests into this folder, you can programmatically determine the Bootstrapper folder location from the Path value in the following registry key:
HKLM\Software\Microsoft\GenericBootstrapper\3.5
Each redistributable component appears in its own subfolder under the packages directory. The product manifest and redistributable files are then put into this subfolder. Localized versions of the component, together with the package manifests, are put in subfolders named according to Culture Name (see the table in CultureInfo).
Once these files have been copied into the Bootstrapper folder, they automatically appear in the Visual Studio prerequisites dialog box so that the developer can select them by checking a box.
For more information about using Bootstrapper to configure your installation, see the MSDN article Use the Visual Studio 2005Bootstrapperto Kick-Start Your Installation.
Keeping Bootstrapper Package Redistributables Separate from Application Installations
As a rule, you should keep any components that are part of a bootstrapper package redistributable separate from applications that use these components. For example, assume that you have a bootstrapper package named Acme.DataWidgets.msi that contains component Acme.DataWidgets.dll. Acme.DataWidgets.dll should not appear in the project's bindir directory at development time, and should not be deployed in the application's installer package.
Therefore, we recommend that you install bootstrapper components to the GAC on your development computers, ideally using the same core bootstrapper package redistributable installer. This will prevent bootstrapper components from being copied to the project's bindir directory at development time. Also, we recommend that you define a RedistList file to describe all the assemblies that are part of the bootstrapper redistributable package. This will prevent bootstrapper components from being included in any application deployment projects. The RedistList file only must be installed on developer computers.
To do this, create a redistributable list in the RedistList folder in your .NET Framework directory (\WINDOWS\Microsoft.NET\Framework).
The redistributable list is an XML file that you should name using the following format: company_name + component_name + RedistList.xml. So, for example, if the component is called "Datawidgets" made by "Acme," use Acme.DataWidgets.RedistList.xml. An example of the redistributable list's contents might resemble this:
<?xml version="1.0" encoding="UTF-8"?>
<FileList Redist="Acme.DataWidgets" >
<File AssemblyName="Acme.DataGrid" Version="1.0.0.0" PublicKeyToken="b03f5f7f11d50a3a" Culture="neutral" ProcessorArchitecture="MSIL" InGAC="true" />
</FileList>