This is another “How I got burnt” today post, so sharing here just in case anyone else finds the same issue. So, I moved one of my team project from TFS 2012 to TFS 2013. After moving the solution, I noticed that one of my builds start producing the following error
The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.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.
This build compiles a solution containing an ASP.Net MVC project, which is where it was complaining about. The solution was already migrated to Visual Studio 2013, so why was it complaining about files for Visual Studio 2012 (v11.0) not being found. Looking closely, it transpired to me that it might be the 2012 Team build template and indeed it was. Although, we have migrated our project to TFS 2013, we were still using the TFS 2012 Build template. The solution was simple – simply passing on the Visual Studio version as an MSBuild argument (as shown below) in the build definition and walla it’s all resolved.