Building C# 6 code on AppVeyor

We all love the new features of C# 6. String interpolation, nameof keyword, auto properties, … and certainly the null-conditional operator! Now we can finally implement INotifyPropertyChanged without being afraid to put it in a variable first for thread safety, as it boils down to a single statement now.

Something else I deeply care about when working on a project, is being backed up by a build server as part of continuous integration. I’ve used dedicated build servers, Visual Studio Online automated builds and since short I learned about AppVeyor as well. AppVeyor is another build server in the cloud, which is able to connect to a wide array of repositories including GitHub, BitBucket, Visual Studio Online, Kiln, … Of course it builds your code, but it also runs your test suite and deploys the different outputs to Web, FTP, Azure, Amazon S3, NuGet, … So about everything most of us developers need. Pricing? Very reasonable, and free for open-source projects.

Many of us have existing code bases and at some point introduce C# 6 syntax. Either using VS 2013 (with some tweaks) or VS 2015 Preview / RTM. Everything builds on your machine, you commit/push your code and BOOM ! Your build fails on this new C# 6 syntax. Luckily it can easily be fixed:

  • Go to Settings / Environment on AppVeyor and change the environment to Visual Studio 2015.


  • Check your solution file and make sure the VisualStudioVersion is 14.xx on the first lines.
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0

It could be that you’ve been working for months under Visual Studio 2015, and that it’s still tagged as Visual Studio 2013 as the version doesn’t get updated as long as you don’t change anything on solution level (adding a project, changing build configs, …).

A sample commit updating from Visual Studio 2013 to Visual Studio 2015 on the Prism open-source project.

Licensed under CC BY-NC-SA 4.0; code samples licensed under MIT.
comments powered by Disqus
Built with Hugo - Based on Theme Stack designed by Jimmy