How to fix Visual Studio Error MSB4018

-1

I am getting the following error (MSB4018) with Visual Studio 2012 Express AND Community 2015. I also get the error when trying to build x86 Assembly Language AND 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

I have tried all the solutions I came across online, and none of them worked. Please help!

visual-studio
visual-studio-2012
.net-assembly
asked on Stack Overflow Nov 2, 2015 by Zach King • edited Nov 2, 2015 by Zach King

1 Answer

0

I solved this issue myself. Although my solution is a bit unorthodox, it did the trick. I have another laptop with Visual Studio installed on it that works fine. So I simply copied my files from "C:\Program Files (x86)\Microsoft Visual Studio 11.0\" to this computer. I also copied "C:\Program Files (x86)\MSBuild\" . As stated in a comment, the issue seemed to be with MSBuild. Therefore, it is possible that only that directory's files were invalid. A proper reinstall of Visual Studio may also solve the problem though.

answered on Stack Overflow Nov 2, 2015 by Zach King

User contributions licensed under CC BY-SA 3.0