This error occurred on our TFS2008 build server which we had upgraded to cater for VS2010 projects (by installing VS2010 on the build server - see this article).
Error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.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.
However - although we had installed VS2010 on the build server - we had not installed the web development components (Visual Web Developer) - this is what caused the error.
To fix - simply add the web development components:
- Go into Control Panel - Add or Remove Programs
- Select Microsoft Visual Studio 2010, and click on Change/Remove
- In the VS Maintenance Mode screens, select Add or Remove Features
- In the Setup - Options page make sure 'Visual Web Developer' is checked.
- Click on Update.
You shouldn't need to restart your build service.