Build errors in TeamCity 9.x

I’ve recently played around with TeamCity 9 installed on a virtual machine in Azure.

Everything works as expected and all builds are working properly. But then, when I add the project that the others are working on, the build fails. When I build it localy it works fine, but when TeamCity fetches it from GitHub it doesn’t build. The error message is

C:\TeamCity\buildAgent\work\f612de5cd923cd\Project\ProjectProject\Project.csproj(250, 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 declaration is correct, and that the file exists on disk.

On my dev computer I got VS 2013 professional when building. On the TeamCity-server I got the bundled version of MSBuild. According to this Stackoverflow post you can’t build MS WebApplications without installing VS. So, the quickest and easiest solution for me was to ask one of the devs to copy the contents of the folder C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\ on their local machine to the TeamCity server.

If this doesn’t solve your problem, or the SO link doesn’t help, check this link out.