Resolve fatal error LNK1123 with Visual Studio 2010 and .NET 4.5
Recently I had to fix a bug in an old C++ application developed with Visual Studio 2010. My computer is newer, so it has .NET 4.5 installed. Guess what? Without any changes the code failed to build with:
LINK: fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
The problem should be fixed in SP1, but getting that installed was non-trivial without admin rights. Fortunately the issue can be traced to a single file:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe. The wrong version is 31,048 bytes, the correct version (from SP1) is 31,056 bytes. The wrong version has a dependency to msvcr100_clr0400.dll whereas the correct version depends on msvcr100.dll. Replace the file (for exampel from another installation with SP1 installed) and the problem is solved! Much faster than patching, not to mention trying to revert from .NET 4.5 to an older version.