使用 Visual Studio 2013,我在构建解决方案时突然开始收到此错误:
The "Copy" task failed unexpectedly.
System.Runtime.InteropServices.COMException (0x800710FE): This file is currently not available for use on this computer. (Exception from HRESULT: 0x800710FE)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at Microsoft.Build.Shared.NativeMethodsShared.ThrowExceptionForErrorCode(Int32 errorCode)
at Microsoft.Build.Tasks.FileState.EnsurePopulated()
at Microsoft.Build.Tasks.FileState.get_FileExists()
at Microsoft.Build.Tasks.Copy.IsMatchingSizeAndTimeStamp(FileState sourceFile, FileState destinationFile)
at Microsoft.Build.Tasks.Copy.DoCopyIfNecessary(FileState sourceFileState, FileState destinationFileState, CopyFileWithState copyFile)
at Microsoft.Build.Tasks.Copy.Execute(CopyFileWithState copyFile)
at Microsoft.Build.Tasks.Copy.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() ScottProj
Run Code Online (Sandbox Code Playgroud)
我没有改变任何应该导致这种情况的构建任务或项目/解决方案配置。我正在更改代码,然后出现了。我回滚了我在此之前所做的特定更改,但这并没有解决它。没有自定义构建事件,只有一个简单的 Build -> Build Solution。我试过这些东西:
清理并重建解决方案。创建了另一个构建配置。关闭 VS 2013。重新启动。删除了 obj 文件夹。
我的下一个操作是删除该项目并从源代码管理中再次获取它。
关于可能导致这种情况或将来防止这种情况的任何想法?
编辑:我能够手动将文件复制到另一个目录并以这种方式重建,不包括“bin”和“obj”文件夹。