Building SSDT SSRS projects (.rptproj) with a build server (TeamCity)

Microsoft .NET

To build SSDT projects with a build server you can use devenv.com or devenv.exe, but not MSBuild.exe because it is not supported by the SSDT tools for Visual Studio 2015. Unfortunately that means installing a licensed copy of Visual Studio on your server. For me this was necessary anyway because we also have to build various Microsoft Office Add-ins and Visual Studio Setup Installer projects (.vdproj).

In TeamCity there are several build runners available, the two common ones for building Visual Studio projects being the Visual Studio (SLN) runner and MSBuild. I had assumed that the SLN runner actually called devenv.exe or devenv.com, but that is not the case. The SLN runner is just more simple and utilizes your existing solution file to produce an in-memory MSBuild file on the fly, while MSBuild is used for more advanced scenarios such as also using MSBuild Tasks as part of your build process. Thus, the SLN runner actually just calls MSBuild.

For building SSDT projects with a build server, you must actually use a command line build by invoking devenv.com. The devenv.com process is similar to devenv.exe, but is designed specifically for command line usage. You can do the same with both, but devenv.exe has the possibility to hang your builds because it may become interactive on the server, waiting for user input, so this is not recommended. Configuring the build step appropriately is really straight forward.

ssdtteamcitybuildstep

The path to denvenv.com will vary depending on your version of Visual Studio, but will be located in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com. Just substitute your version in place of 14.0 and you’re set. You can also build your solution with various other parameters that are supported (run devenv.com /? from the command line), such as /Build and with different platforms /Build "Debug|x86".

MSBuild Support for SSDT

SQL Server Data Tools, or SSDT, has been the replacement for Business Intelligence Studio for some time now. The first major release of the tools usually comes shortly after the initial release of a new major version of Visual Studio, and it wasn’t until June this year that the tools made their debut for Visual Studio 2015. The release cycles are getting better as it appears in the next edition of Visual Studio they have already been working on the tools, hopefully for a release that is in sync with the main IDE debut. The tools we already have for Visual Studio 2015 do not currently support building the various SSDT projects via MSBuild, but it appears that they have introduced this functionality, albeit limited this far, in the Visual Studio “15” Preview 4 as a Nuget package. From a reply to a comment I posted, it appears it only supports building SQL Server Database projects (.sqlproj) at this time.

1 Comment

  1. Hugues Gauthier

    it works perfectly when I get any desktop session open. If I close every open desktop session, nothing works.
    [Step 1/1] Microsoft Visual Studio 2015 Version 14.0.25420.1.
    [14:17:20] [Step 1/1] Copyright (C) Microsoft Corp. All rights reserved.
    [14:17:20] [Step 1/1] [14:17:21] [Step 1/1] Microsoft Visual Studio has detected a configuration issue. To correct this, please restart as Administrator. For more information please visit: go.microsoft.com/fwlink/?LinkId=659046 [14:17:21] [Step 1/1] Process exited with code 1

    Reply

Leave a Comment

Your email address will not be published.