I installed VS2012 Professional (on Win7 32-bit), tried compiling a few projects, and everything seemed to be working OK. Then I installed Update 1, and ever since MSBuild fails to build all projects.
I tried the following test - create a new console application. Selected theEmpty Project option, all other checkboxes are unchecked. Added a new file namedmain.cpp to the project. The file contains a single line
int main() {}
MSBuild fails (both Debug and Release configurations) when trying to build this project. The IDE output window shows the following error:
1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: The "CL" task failed unexpectedly.
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: System.TypeInitializationException: The type initializer for 'Microsoft.Build.Utilities.FileTracker' threw an exception. ---> System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at Microsoft.Build.Shared.NativeMethodsShared.ThrowExceptionForErrorCode(Int32 errorCode)
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at Microsoft.Build.Shared.NativeMethodsShared.GetLongFilePath(String path)
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at Microsoft.Build.Utilities.FileTracker..cctor()
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: --- End of inner exception stack trace ---
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at Microsoft.Build.CPPTasks.CL.ComputeOutOfDateSources()
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at Microsoft.Build.CPPTasks.TrackedVCToolTask.SkipTaskExecution()
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at Microsoft.Build.Utilities.ToolTask.Execute()
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at Microsoft.Build.CPPTasks.TrackedVCToolTask.Execute()
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(347,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I've tried to call cl.exe from the command line, and the file gets compiled successfully. I used
cl main.cpp
Also copy pasted options from the IDE and invoked it as
cl <compiler options> main.cpp /link <linker options>
and it works.
However, trying to run MSBuild on the solution fails with the same errors. I've uploaded the project I was using, along with the output from MSBuild (in msbuild.log) obtained using
MSBuild Test.sln /p:Configuration=Debug /verbosity:diag
to
SkyDrive (Test.zip). Could someone please take a look at what the problem might be?