Visual Studio 2015, C# 6.0, TeamCity and new build errors
Have you upgraded your Visual Studio solution to VS2015 and started using the new C# 6.0 stuff, and use TeamCity? I hit a few issues on the way that might be worth sharing.
Visual Studio 2015 is out, and you should of course update as soon as you can. I did, and moved a project under development from VS2013 to VS2015 and started using the new C# 6.0 language features. No issues there. However, when pushing all changes to TeamCity, things broke a bit.
Here are the steps we had to go through to fix it all:
- Make sure you have updated to TeamCity version 9 or newer. This adds support for the VS2015 build runner. Before these are added, you'll get syntax problems (example:
Invalid token '=' in class, struct, or interface member declaration
) and the like, since it doesn't understand C# 6.0. When done, update your build step to use VS 2015. - After this is done, your build agents might tell you about an unmet requirement: MSBuildTools14.0_x86_Path exists. To fix this, install the Microsoft Build Tools 2015 RC (or get the final version when it's out. It doesn't seem to be at the time of writing).
- Even after that, I got an error stating error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\ Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
.
To fix this, simply copy that folder from your local machine (Where you have installed VS2015, of course) to the server(s) running the TeamCity build agents. - Success!