Coding with Titans

so breaking things happens constantly, but never on purpose

HowTo: Setup SSIS project to build via TeamCity

It should be simple, it should be quick. And as usual it turned out to be hard, painful and forced me to install Visual Studio 2017 back on a build machine. I’ve cried a lot that hour. Now I am just waiting, what will fail next, once I see this comment in TC build logs, even though I logged-in and obtained permanent license.

[13:05:08][Step 3/3] Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script5352870621326270693.cmd
[13:05:08][Step 3/3] in directory: C:\TeamCity\buildAgent\work\2906b7d01f979ef5[13:05:12][Step 3/3]
[13:05:12][Step 3/3] Microsoft Visual Studio 2017 Version 15.0.27428.2027.
[13:05:12][Step 3/3] Copyright (C) Microsoft Corp. All rights reserved.
[13:05:12][Step 3/3]
[13:05:12][Step 3/3] The license for Visual Studio expires in 30 days.

Anyway, it makes me to loose even more hairs, due to the fact, that not so long ago I happily removed Visual Studio 2010 from it (check this post)! And simply Visual Studio 2017 build-tools were not enough for the SQL Server Data Tools (SSDT) installer including SQL Server Integration Services (SSIS). Somehow documentation stays, it should be possible to continue and that it will install minimal version of Visual Studio (Shell or something?), but at 85% it tried to apply some VSIX package, failed and roll backed everything.

What’s even worse, is that .dtproj project format is incompatible with MSBuild and it’s impossible to build it without essentially Visual Studio IDE (i.e. devenv.com, check here). Even if you wish to build it using VSTS Online/TFS you still need some tricks.

I hope I linked all stuff, that helped me to understand the subject. So let’s stop weeping and wailing and let’s get something done!

TL;DR

Prerequisites:

Now in TeamCity:

  • Create a build configuration (here named “Bazy Win32” on figures below)
  • Add new parameter that points to the location of devenv.com of the Visual Studio

TeamCity build parameters

i.e.: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.com

  • Add a command-line build step, that will invoke Visual Studio and instruct it to build the solution

TeamCity build step

The command is: “%env.vs2017_devenv_path%” <path_to_solution> /rebuild “Development”

(variable is taken in quotation marks, since it contains spaces etc. as its value)

  • Remember to put generated .ispac (from bin/Development folder) among other artifacts of the build configuration.
  • DONE!

EDIT 2018-06-22:

Look here for some troubleshooting guide, as there are build problems that might araise after some time.