C# 6.0/Visual Studio 2015 on TeamCity

At first you will have to update to TeamCity 9.x (9.1.7 at the time of this post) to support Visual Studio 2015 compilation.

After upgrading (with some hassles, of course, but you’ll figure out), you’ll have TeamCity 9.x up and running. Now the time for some configuration. Change your compiler in build definition to Visual Studio 2015 and you are ready to go!

Change the Visual Studio to 2015

Change the Visual Studio to 2015

Not so fast. You will soon notice that most (if not all) of your build agents are not unusable.

MSBuildTools14.0_x86_Path does not exists
MSBuildTools14.0_x86_Path does not exists

Solution? Download and install Microsoft Build Tools 2015 from

https://www.microsoft.com/en-us/download/details.aspx?id=48159

Then you will need to restart TeamCity build agent on the agent server:

(Press Windows and then type in Services.msc. Find the service named “TeamCity Build Agent”, right click and choose “Restart”

Restart TeamCity Build Agent
Restart TeamCity Build Agent

)

Wait for a moment and the agent should show up as having the that configuration:

MSBuildTools 14.0 is ready
MSBuildTools 14.0 is ready

Now start rolling builds!

If you are lucky, your builds will succeed now. But if you’re like us, where you use extra MSBuild tasks, you might still run into problems:

  • Error MSB4019: The imported project “C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets” was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Because you did not install the full version of Visual Studio 2015 on your build agents (and you should not, unless you have plenty of licenses to spare).

When you install MsBuildTools 14, a minimal number of .targets files were installed. That might not be not enough. You’ll need to copy over this folder from a machine with VS2015 installed:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0

to the same folder in the build agent.

  • CSC error CS1566: Error reading resource ‘Mediachase.ConsoleManager.dll.licenses’

You’ll need to install Windows 10 Software Development Kit to the build agent server.

https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

However, only .NET 4.6 SDK is required.

  • C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\ReportingServices\Microsoft.ReportingServices.targets(24, 2): error MSB4062: The “Microsoft.Reporting.RdlCompile” task could not be loaded from the assembly Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91. Could not load file or assembly ‘Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91’ or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Microsoft ReportViewer runtime 2015 is missing – download and install https://www.microsoft.com/en-us/download/details.aspx?id=45496

  • C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(468, 5): error MSB4062: The “SqlModelResolutionTask” task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\\Extensions\Microsoft\SQLDB\Dac\130\Microsoft.Data.Tools.Schema.Tasks.Sql.dll. Could not load file or assembly ‘file:///C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\Dac\130\Microsoft.Data.Tools.Schema.Tasks.Sql.dll’ or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

SSDT Tools for Visual Studio 2015 is missing. Download and install

http://download.microsoft.com/download/4/5/D/45D2F536-D747-417D-A510-9CCEEDCD28D3/Dev14/EN/SSDTSetup.exe

See, it’s only a few easy steps. Now it builds! I can’t be happier.

Except we have 9 build agents to roll out all of these steps.

Oh gosh!

Leave a Reply

Your email address will not be published. Required fields are marked *