Visual Studio错误:"GenerateResource"任务意外失败...文件存在

Visual Studio错误:

问题描述:

我正在尝试为许多项目构建解决方案,并且在Windows Service项目中遇到此错误:

I am trying to build a solution with many projects, and I'm getting this error for a Windows Service project:

The "GenerateResource" task failed unexpectedly.
System.Runtime.InteropServices.COMException (0x80070050): The file exists. (Exception from HRESULT: 0x80070050)
   at Microsoft.Build.Shared.NativeMethodsShared.InprocTracking.WriteContextTLogs(String intermediateDirectory, String tlogRootName)
   at Microsoft.Build.Utilities.FileTracker.WriteContextTLogs(String intermediateDirectory, String taskName)
   at Microsoft.Build.Tasks.GenerateResource.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)   ImportProcessorWindowsService

按照另一个类似的问题中的建议,我尝试了删除我的.suo文件,但这无济于事.

As suggested in another similar question, I tried deleting my .suo file, but that did not help.

最近我已经能够构建此解决方案.我该如何解决?

I have been able to build this solution in the recent past. How do I fix this?

我知道了.似乎是由于obj/x86文件夹中的某些文件被标记为只读"引起的.

I figured this out. It seems to have been caused by some files being marked Read Only in the obj/x86 folder.

TFS非常喜欢将文件标记为只读.

Lovely how TFS likes to mark files as Read Only.

我删除了obj/x86的内容,错误消失了.

I deleted the contents of obj/x86 and the error went away.