Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Configure TeamCity to Support Compilation of C# 6 Code using MSBuild

For quite a long time, our team chose not to mess with our working Teamcity configurations, which compile, build, test, and deploy our code several times a day.

Two weeks ago, we finally upgraded our last and at the same time biggest project discoverize to work with Visual Studio 2017. This allowed us to take a fresh look at the *cough* new C# language features that we have been ignoring for the last few years. But using any of them also meant having to upgrade our continuous integration infrastructure to support them. Here's what we've done.

Update all TeamCity configurations

If you use the MSBuild runner, now choose the Microsoft Build Tools 2017 as the MSBuild version and set the MSBuild ToolsVersion to 15.0:

This will lead to the error that no Build Agents can be found for the given configuration because a requirement is not met:

MSBuildTools15.0_x64_Path cannot be found.

Install new Build Tools

Thanks to this Stackoverflow answer I quickly learned that I had to install the Build Tools for Visual Studio 2017. You can get the web installer from here. More information about the options in the tool can be found on this page.

The first screen shows the possible workloads (as of August 2017) with Web development build tools selected…

… and the second screen shows the individual components selected (I actually unchecked all optional .NET Framework targeting packs):

Restart the TeamCity Agent Service

For TeamCity to realize that you've installed new tools on you build machine, you need to restart the Agent Service. You can find it e.g. after running services.msc from the Start menu –> Run command.

Missing AllRules.ruleset file

Now, the compilation of our C# 6 project finally succeeded. There was still one problem: the build log contained warnings about a AllRules.ruleset file missing. I just went ahead and copied the file from my local machine (including the full folder hierarchy) because I could not find any information on where to find this file other than on my own machine (with Visual Studio installed). After that last step, the build log is finally black again.

Happy configuring!



This post first appeared on Shades Of Orange | Our Code Is Orange - Softwar, please read the originial post: here

Share the post

Configure TeamCity to Support Compilation of C# 6 Code using MSBuild

×

Subscribe to Shades Of Orange | Our Code Is Orange - Softwar

Get updates delivered right to your inbox!

Thank you for your subscription

×