如何修复Visual Studio错误MSB4018

时间:2015-11-02 16:22:54

标签: visual-studio visual-studio-2012 .net-assembly

我在Visual Studio 2012 Express和社区2015中遇到以下错误(MSB4018)。我在尝试构建x86汇编语言和C ++时也遇到错误。

Error   1   error MSB4018: The "Link" task failed unexpectedly.
System.TypeInitializationException: The type initializer for 'Microsoft.Build.Utilities.FileTracker' threw an exception. ---> System.Runtime.InteropServices.COMException: There are no more files. (Exception from HRESULT: 0x80070012)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.Build.Shared.NativeMethodsShared.ThrowExceptionForErrorCode(Int32 errorCode)
   at Microsoft.Build.Shared.NativeMethodsShared.GetLongFilePath(String path)
   at Microsoft.Build.Utilities.FileTracker..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.Build.Utilities.DependencyTableCache.FormatNormalizedTlogRootingMarker(ITaskItem[] tlogFiles)
   at Microsoft.Build.Utilities.CanonicalTrackedOutputFiles.ConstructOutputTable()
   at Microsoft.Build.Utilities.CanonicalTrackedOutputFiles.InternalConstruct(ITask ownerTask, ITaskItem[] tlogFiles, Boolean constructOutputsFromTLogs)
   at Microsoft.Build.CPPTasks.TrackedVCToolTask.ComputeOutOfDateSources()
   at Microsoft.Build.CPPTasks.TrackedVCToolTask.SkipTaskExecution()
   at Microsoft.Build.Utilities.ToolTask.Execute()
   at Microsoft.Build.CPPTasks.TrackedVCToolTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__1.MoveNext()  C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets  611 5   Project

我已经尝试过我在网上遇到的所有解决方案,而且都没有。请帮忙!

1 个答案:

答案 0 :(得分:0)

我自己解决了这个问题。虽然我的解决方案有点不正统,但它确实起到了作用。我有另一台安装了Visual Studio的笔记本电脑,工作正常。所以我只是将文件从“C:\ Program Files(x86)\ Microsoft Visual Studio 11.0”复制到此计算机。我还复制了“C:\ Program Files(x86)\ MSBuild \”。正如评论中所述,问题似乎与MSBuild有关。因此,可能只有该目录的文件无效。正确地重新安装Visual Studio也可以解决问题。