LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 .NET 4.5 installed Visual Studio 2012 Release Preview

Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' after installing Visual Studio 2012 Release Preview

Answer1:If disabling incremental linking doesn't work for you, and turning off "Embed Manifest" doesn't work either, then search your path for multiple versions of CVTRES.exe.

By debugging with the /VERBOSE linker option I found the linker was writing that error message when it tried to invoke cvtres and it failed.

It turned out that I had two versions of this utility in my path. One at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cvtres.exe and one at C:\Windows\Microsoft.NET\Framework\v4.0.30319\cvtres.exe. After VS2012 install, the VS2010 version of cvtres.exe will no longer work. If that's the first one in your path, and the linker decides it needs to convert a .res file to COFF object format, the link will fail with LNK1123.

(Really annoying that the error message has nothing to do with the actual problem, but that's not unusual for a Microsoft product.)

Just delete/rename the older version of the utility, or re-arrange your PATH variable, so that the version that works comes first.

3  
Thanks, this was my case. I have .NET 4.5 installed and turning off incremental linking and Embed Manifest didn't fix the problem. Renaming the "cvtres.exe" in 2010 did. –  B-Con Jan 24 '13 at 0:58
5  
Worked for me with Visual Studio Express 2010 and 2012. Renaming 2010's cvtres.exe to cvtresold.exe fixed the problem. –  Juanjo May 8 '13 at 21:30
3  
This should be included in the main answer as a secondary option. It was my case too. –  twerdster May 17 '13 at 20:03
9  
Thanks a lot. I renamed "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe" and it worked instantly. –  mnVoh Jul 1 '13 at 8:50
1  
Renaming the cvtres.exe worked for me! –  perceptron Dec 30 '13 at 7:40

Answer2:

According to this thread in MSDN forums: VS2012 RC installation breaks VS2010 C++ projects, simply, take cvtres.exe from VS2010 SP1

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe

or from VS2012

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cvtres.exe

and copy it over the cvtres.exe in VS2010 RTM installation (the one without SP1)

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe

This way, you will effectively use the corrected version of cvtres.exe which is 11.0.51106.1.

Repeat the same steps for 64-bit version of the tool in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\cvtres.exe.

This solution is an alternative to installation of SP1 for VS2010 - in some cases you simply can't install SP1 (i.e. if you need to support pre-SP1 builds).

 

 

 

posted @ 2014-03-07 17:10  xingrun  阅读(502)  评论(0编辑  收藏  举报