VS2012:将中间目录更改为 TEMP 文件夹会导致链接器不更新可执行文件

VS2012: Changing intermediate directory to TEMP folder causes linker not updating executable

这真是个奇怪的问题,我 运行 花了几个小时来缩小范围。

重现步骤:

  1. On Windows 8 在 Visual Studio 2012 中创建一个简单的 VC++ 项目(控制台)。

  2. 构建和 运行 可执行文件。

  3. 如果您更改源文件并构建,链接器会更新可执行文件。这是意料之中的。

  4. 现在将中间目录(在 Project Properties -> General 下)更改为 $TEMP 文件夹,默认情况下为:

C:\Users\ username \AppData\Local\Temp

  1. 现在,如果您更改源代码并构建,它会显示构建成功,但可执行文件将不会更新

如果我们将中间文件夹更改为 $TEMP 以外的任何内容,这确实很奇怪而且令人惊讶,它工作得很好。

知道为什么会这样吗?

经过大量搜索和调查,我终于在 Microsoft 网站的一个角落找到了它,这是 Visual Studio 中的真正问题。据报道here

并且如那里所述:

Posted by Microsoft on 11/16/2012 at 7:08 PM

Thanks for the log. The build system doesn't support the Intermediate directory as and/or a subfolder of the Temp directory.

IntDir = c:\temp\buildme\
TEMP = c:\temp Could you change your IntDir to another folder and see if the issue still reproduces?

Thanks

Posted by Microsoft on 4/29/2014 at 12:31 PM

Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436