At DrDoctor we’ve been using Octopus Deploy for about a year and half now, and in that time we have developed a very robust way of releasing the core of our system. That is, two IIS websites and a bunch of windows services. Release automation has vastly increased the frequency at which we release software into production and in turn the speed at which the business can operate.
The missing part in all of this are the integration projects, when DrDoctor begins working with a new hospital we do a bunch of work integrating their PAS system into our system. This takes the form of a couple of staging databases and a couple of SQL Server Integration Services (SSIS) projects.
Whenever we are discussing changes that need to be made we always screw up our faces at the thought of doing the release. We also have no idea which clients have which version, or when we last did a release.
In this and a few subsequent posts I’m going to outline the various steps that I took to automate our deployments, so we can get on doing the interesting work and let the computers handle the boring deployment work.
Building SSIS Projects in TeamCity
The first step required is to have TeamCity build our Integration Services (SSIS) projects in TeamCity. In reality all it’s really doing is taking all the .dtsx packages that are part of the project and turning them into an ispac file.
The ispac is basically a zip file that contains all the packages and some other metadata which is used when deploying into SQL Server SSISDB.
There are two methods that come up from a Google search on getting TeamCity building SSIS projects, the first involves using a community MSBuild extension and a bunch of other bits, you can read more about it here or here, you can find the MSBuild extension on CodePlex. I tried this method, but didn’t have immediate success.
The second option is to use Visual Studio (SQL Server Data Tools) devenv.exe to build your project, this was already installed on our build server as it is required when building database projects.
To do this in the TeamCity project’s build configuration I added a new build step, which was a Command Line runner:
In the custom script I put in the full path to devenv.exe, our SSIS projects are built in SSDT BI 2012 (Visual Studio 2012 shell) so I’m using that version of devenv.exe on the build server.
Packaging SSIS Projects for deployment
Now that TeamCity is building the project it time to setup TeamCity to package the ispac file into a NuGet package. As mentioned in the intro, we use Octopus Deploy as our deployment system, it in turn uses the NuGet package format as the container for application files (more details).
Setting up TeamCity to automate the creation of NuGet packages turns out to be really easy.
Creating a NuSpec file
The first step is to create a NuSpec file, this is the manifest file that TeamCity will use when building the NuGet package (it tells TeamCity which files to include in the package).
To set this up I added a new file called Local_ETL.nuspec into my project folder with the following content
<?xml version="1.0" encoding="utf-8"?> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>SSIS.Local_ETL</id> <version>1.0.0</version> <authors>DrDoctor</authors> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Sync client to local</description> </metadata> <files> <file src="bin\Development\DrDoctor Client ETL.ispac" target="DrDoctorClientETL.ispac" /> </files> </package>
This as you can specifies a NuGet package ID, a version and a bunch of files that should be included.
Add build step in TeamCity
The next and final step is to configureTeamCity to create the NuGet package using the NuSpec file.
In TeamCity go into the Build Steps of your project, and click Add build step. From the runner type select NuGet Pack and configure the step with the following:
Make sure that you have ticked “Publish created packages to build artifacts”. This will ensure that the packages are available through the built-in NuGet repository.
In the next post I’ll show how I setup my deployment project in Octopus Deploy to deploy the SSIS ispac to SQL Server SSISDB.
4 thoughts on “Building and packaging SQL Server Integration Services projects in TeamCity”
[…] my previous blog post I outlined how to configure TeamCity to build SQL Server Integration Services projects and then […]
[…] first is to manually edit the project file adding the targets for OctoPack, the other method is to use a NuSpec file and the NuGet Package build step in TeamCity. The following snippet needs to be pasted at the very bottom of the .sqlproj file right before the […]
[…] with automating the release of our client integration projects. I’ve shown how to get TeamCity to build Integration Services projects and then how to deploy them into SQL Server SSIS Catalog with Octopus […]
Hi, I am trying to use your method but I get an error that “Integration Services Project1\xxx.dtproj cannot be found. How do I overcome this issue ? I dont see any path that uses Integration services name defined in properties or build scripts