| This section discusses how the Phoenix Installer project is put together from a software developer perspective. For end-user information on how to use the Phoenix Installer, please consult the Phoenix Help Wiki. |
This topic contains the following sections.
- Quick Guide to Building the Installer
- How the Installer Project is Put Together
- Building the Phoenix Installer
- A Step by Step Guide
- 1. Set Active Configuration
- 2. Pre-compile the Web Project
- 3. Concatenate the Database scripts
- 4. Build the NodeConfigTool tool
- 5. Build the Installer
- Installer Data Flow
- Related Topics
Quick Guide to Building the Installer
If you'd like to skip the gory details, and just build the installer, refer to the Quick Guide to Building the Phoenix Installer.
How the Installer Project is Put Together
This section will attempt to demystify the inner workings of the Phoenix Installer.
The installer is simply a Visual Studio Setup Project. It was added to the solution using Add > New Project and selecting the Setup and Deployment project template as illustrated below.

Project Outputs
The installer does not create the actual Phoenix website or database -- this is the job of the Phoenix Node Configuration Tool. As the diagram below shows, all the installer needs is the output of the Phoenix.Services project and the output of the NodeConfigTool project.

Project outputs were added by right-clicking the installer project and selecting Add > Project Output.

Custom Actions
During installation, there are some additional steps we need to take to ensure that several Phoenix components are configured properly. The PhoenixServices for example need to create some local folders, and some environment variables must be set so that MapServer will function.
This logic is found in the Phoenix.Services..::.PhoenixSearchServiceInstaller class. This class is decorated with a [RunInstaller(true)] attribute which will ensure that the Windows installer (the .msi) can see our installer code.
The code within the PhoenixSearchServiceInstaller class contains references to three ServiceInstaller classes (one for each of the three services). Each of these classes is responsible for executing the steps needed to configure the service.
The Custom Actions Editor within Visual Studio is used to wire up our installer class. Notice that all four actions Install, Commit, Rollback and Uninstall have been set to the primary output of the Phoenix.Services project even though not all events are handled in our installer class.

During installation, the events occur in the order shown below.
- ServicesInstaller..::.Install(IDictionary)
- PhoenixEmailServiceInstaller..::.Install(IDictionary)
- PhoenixFileServiceInstaller..::.Install(IDictionary)
- PhoenixSearchServiceInstaller..::.Install(IDictionary)
- ServicesInstaller..::.Commit(IDictionary)
- PhoenixEmailServiceInstaller..::.Commit(IDictionary)
- PhoenixFileServiceInstaller..::.Commit(IDictionary)
- PhoenixSearchServiceInstaller..::.Commit(IDictionary)
| The Windows installer does not start firing events until the user has clicked on the final confirmation button. |
Building the Phoenix Installer
Although the installer project itself is quite simple, care must be taken to ensure that it is built properly. The installer project is simply a container for other components that it has been charged to deploy. It is getting the parts properly built that is the trick.
The installer is dependant on the output of two projects: Phoenix.Services and NodeConfigTool. Both must be built prior to building the installer.
| In Visual Studio, pressing F6 or Ctrl+Shift+B is not enough to force all installer dependancies to build. The solution file has been configured not to build the NodeConfigTool project in Release mode. This is due to the additional (and potentially time-consuming) build events that occur when this project is built. You must manually build the NodeConfigTool project prior to building the installer. |
A Step by Step Guide
This section will show you how to properly build the Phoenix Installer.
1. Set Active Configuration
Before building the installer make sure the solution's active configuration is set to "Release" mode. The installer cannot be build in "Debug" mode as some components are hard-coded to look in the release folder for required elements.

2. Pre-compile the Web Project
| This step is a prerequisite for the NodeConfigTool. You are only required to perform this step if there have been changes to the web application or phoenix class libraries. |
The Phoenix web application must first be pre-compiled.
To pre-compile the web project we use a Web Deployment Project. This project takes both the content (markup) and the code (C#) for each page, parses it, compiles it, and merges it into a single assembly. The resulting web-application, will be easier to deploy, run faster, and be more secure.

3. Concatenate the Database scripts
| This step is a prerequisite for the NodeConfigTool. You are only required to perform this step if there have been changes to any of the database script (.sql) files. |
The numerous database scripts must be concatenated together.
The easiest way to concatenate the database scripts is to execute the batch file joinscripts.bat which can be found in the Phoenix.Database project in the Deployment subfolder.
|
Please review the joinscripts.bat file before executing it. In particular, you need to set the two variables: output and installscripts.
|
3.1. Open a Command Line
3.2. Change your current directory to the folder that contains the batch script.
3.3. Type joinscripts
The sql scripts will be joined and copied into the configured locations. Note that three script files were created.
- 2functions.sql -- contains all the User Defined Functions
- 3views.sql -- contains all Views
- 4sprocs.sql -- contains all Stored Procedures (sprocs)
4. Build the NodeConfigTool tool
Recall that the NodeConfigTool is the application that creates and configures individual Phoenix nodes. In order to do this, it must contain the latest binaries of the Phoenix web application as well as the database scripts, so they can be deployed any time the tool is executed. Therefore, some additional steps must be taken prior to building NodeConfigTool.
To ensure that these steps have been taken, the NodeConfigTool project contains a Pre-Build Event which Visual Studio will execute before the project is actually compiled. To view or edit the Build events, right-click the project and select properties. Click on the Build Events tab.

The pre-build event is configured to run a console application called prebuild.exe. It is the job of prebuild to sanitize and compress the files in the web application folder, as well as the database scripts.
Review the prebuild topic for more information.
Build the NodeConfigTool project as you normally would.
5. Build the Installer
You are now ready to build the installer.
Highlight the Phoenix.Installer project and select build.

If there were no errors, you should have an installer application in the output folder. D:\projects\pathways\phoenix\trunk\Installer\Release, for example.
Installer Data Flow
The diagram below shows how the components of the installer are assembled together.

