After we upgraded to Visual Studio 2015 and started to use some of the new language features in C#6, we got some trouble at work with some of our CI builds. We use TeamCity as build server and we had recently updated to 9.1.1. The builds was using the Visual Studio sln build configuration and was set to Visual Studio 2013.

The error was unexpected character ‘$’. So it was easy to understand that it was the new string interpolation that was causing out build to break.

error CS1056: Unexpected character '$'

The first thing we did was to change the configuration to use Visual Studio 2015, but that only made the build incompatible with all of our build agents.

We then installed the build tools for 2015 and restarted the server. Then the build had compatible agents, and the build worked again. Here is a link to the Microsoft Build Tools 2015

This was for an internal library that now was working again, but there still was a web project that had problems. This time the build was complaining about some missing files.

C:\TeamCity\BuildAgent\...\Web.csproj(1045, 3): 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 error, we copied over the files from a computer with Visual Studio 2015 installed to the build server and this build was working again. We actually copied over the whole v14.0 folder.

blog comments powered by Disqus

About Sebastian

Sebastian Holager

Sebastian Holager is a developer working at a CRM Norge in Oslo, Norway. At day time hacking away on Dynamcs CRM, C# and JavaScript. While at night playing around with other programming languages, reading and watching football.

Follow me on twitter