When developing and deploying SSIS packages, it is crucial to keep track of version information. However, version information is often hidden in package properties, making it difficult to quickly identify the version and build being modified. In this article, we will explore a simple trick to display version information on the Control Flow surface, allowing developers to easily identify the version and build they are working on.
The Problem
Imagine a scenario where a SSIS package fails and needs to be corrected. The developer retrieves the latest version from the version control system (VCS) and starts working on it. However, there is uncertainty whether this is indeed the correct version. Has a colleague made any corrections that haven’t been updated in the VCS? To verify this, the developer checks the package version information (version major, minor, and build) and compares it. Alternatively, they may choose to investigate the problem using the production package. This raises the question of whether the corrected version should be put back into the source control system.
Wouldn’t it be helpful to have the package version readily available on the Control Flow design surface? By seeing the current version while developing a package, developers can ensure they are working on the correct version and also remember to update it when necessary. Additionally, having the version displayed can be useful for maintaining a version history description.
The Solution
To display the package version on the Control Flow design surface, we can utilize the name property of a sequence container in the control flow and set its value using expressions. The name property is evaluated whenever the package is loaded or executed and is displayed on the surface.
Here’s how you can implement this solution:
- Add an empty Sequence Container before the other tasks in your control flow (e.g., SEQC Your Control Flow). You can collapse it since no tasks will be added to it.
- Open the properties of the Sequence Container and find the Expressions option. Click the ellipsis button to open the Property Expression Editor.
- In the Property Expression Editor, select the Name property from the drop-down list under Property.
- Click the ellipsis button under Expressions to open the Expression Builder.
- Construct the name string using the desired format. For example, you can use “SEQC” (an acronym for Sequence Container) followed by the PackageName, VersionMajor, VersionMinor, and the build number between brackets. Ensure that all variable values are correctly casted.
- Click OK twice to close the Property Expressions Editor.
Upon checking the name of the Sequence Container, you may notice that it hasn’t changed immediately. This is because Visual Studio does not always refresh the control flow display. However, when the package is reloaded, the name of the Sequence Container will be updated, allowing you to see the name and version of the package when you open it.
It is now your responsibility to set and maintain the version numbers. VersionMajor and VersionMinor should be set manually, while VersionBuild is automatically increased every time the package is executed.
By incorporating the version information into error messages generated by the package, you can easily identify the version in which an error occurred. This enables you to open the corresponding package from the source control system and verify that you are correcting the correct version.
With this simple trick, you can enhance the visibility and management of version information in your SSIS packages, making it easier to track changes and ensure you are working on the correct version.