0
votes

I am using TFS 2013 to build my project but sometimes I am getting the error as:

The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets" was not found.Confirm that the path in the declaration is correct, and that the file exists on disk.

I have gone through many answers and found a lot of workaround to fix it but “in my case the problem is that sometime my build is success and sometimes it is failing.”

Let say I am running my build for 10 times then 3-4 times it is passing and 6-7 times it is giving error.

I have checked the path on server and the file

"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets"

exists at the same location where TFS build is looking for.

I have also visited the link

TFS build errors a file not found, while file exists

but there is no answer provided on this thread.

I want to do very minimal changes. Please suggest what would be the possible solution to make .targets file always available.

Update:

I have found a similar question at the link

TFS Build missing .targets files intermittently

but the answer provided at this thread does not solve my problem and even if it's a kind of question again not the solution that's why I have started a separate thread.

1
If you use MSBuild command to build the project manually on your build agent machine, will you reproduce this issue?Cece Dong - MSFT
Do you install VS 2013 on your build agent server?Cece Dong - MSFT
@Cece-MSFT, yes I have installed VS 2013 on build agent machine.Banketeshvar Narayan

1 Answers

0
votes

You may try the items below:

  1. Clean the Cache folder on your build agent machine. The folder path is: C:\Users\username\AppData\Local\Microsoft\Team Foundation\5.0\Cache.
  2. Clean the cache folder on your TFS machine: C:\Program Files\Microsoft Team Foundation Server 12.0\Application Tier\Web Services\_tfs_data
  3. Try to use the NuGet package MSBuild.Microsoft.VisualStudio.Web.targets, referencing them in your project.
  4. Try to create another light project to test whether you would get the same issue.