我们都知道 VS2010 对其构建系统进行了重大升级,该系统基于 MSBuild。
根据 MS 代表的说法(请参阅 Visual Studio 2010 总是在计算机休眠/重新启动后重建项目)MSBuild 现在将自身注入到其他工具中(例如 C++ 编译器、链接器等)来找出目标的依赖关系。
这种方法的缺点之一是,现在由于不相关文件的修改,您的项目可能会被强制重建 :(
在我的例子中,它是 C:\PROGRAMDATA\NVIDIA CORPORATION\DRS\NVDRSDB0.BIN
,它由 NVIDIA 更新服务(Windows 7 32 位)定期更改。
我发现通过将 VS2010 选项“MSBuild 项目构建输出详细程度”和“MSBuild 项目构建日志文件详细程度”转换为“诊断” .
之后,我能够在“构建输出”窗口中看到问题的原因:
Task "CL" (TaskId:55)
Read Tracking Logs: (TaskId:55)
..\..\temp\Release\Editor\cl.read.1.tlog (TaskId:55)
Outputs for E:\USERS\A.USER.ORG\DEVEL\EDITOR\STDAFX.CPP: (TaskId:55)
E:\USERS\A.USER.ORG\DEVEL\TEMP\RELEASE\EDITOR\STDAFX.OBJ (TaskId:55)
C:\PROGRAMDATA\NVIDIA CORPORATION\DRS\NVDRSDB0.BIN was modified at 23-Feb-12 12:08:20. (TaskId:55)
stdafx.cpp will be compiled. (TaskId:55)
...
Tracking command: (TaskId:55)
C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\Tracker.exe ... stdafx.cpp /clr:nostdlib (TaskId:55)
stdafx.cpp (TaskId:55)
Done executing task "CL". (TaskId:55)
解决方法之一是将不相关的文件添加到 C++ 忽略列表:
<ItemGroup>
<ClNoDependencies Include="NVDRSDB0.BIN" />
<ClNoDependencies Include="C:\PROGRAMDATA\NVIDIA CORPORATION\DRS\NVDRSDB0.BIN" />
</ItemGroup>
不幸的是,这没有帮助:( 而且我 检查此技巧在其他 PC 上的工作原理,因为这些文件不存在,
因此问题仍然存在:有人知道此问题的有效解决方案吗?
尚未 VS2010 SP1 - 根据对于爱好者来说,这一步也没有帮助。
禁用 NVIDIA 更新服务可能会有所帮助(它将停止更新文件),但有或可能有其他软件无法通过这种方式禁用(防病毒软件、其他实用程序等)。
另请参阅相关问题:
As all of us already know VS2010 has got an major upgrade of its build system, which is based on MSBuild.
According to MS representatives (see comments in Visual Studio 2010 always rebuild project after hibernation/restart of computer) MSBuild now injects itself into other tools (like C++ compilers, linkers, etc.) to find out the dependencies of a target.
One of the drawbacks of such approach is that now your project may be forcedly rebuilt because of modifications in irrelevant files :(
In my case it is C:\PROGRAMDATA\NVIDIA CORPORATION\DRS\NVDRSDB0.BIN
, which is periodically changed by NVIDIA update service (Windows 7 32-bit).
I've discovered that by turning VS2010 options "MSBuild project build output verbosity" and "MSBuild project build log file verbosity" to "Diagnostic".
After that I was able to see the cause of the issue in the Build Output Window:
Task "CL" (TaskId:55)
Read Tracking Logs: (TaskId:55)
..\..\temp\Release\Editor\cl.read.1.tlog (TaskId:55)
Outputs for E:\USERS\A.USER.ORG\DEVEL\EDITOR\STDAFX.CPP: (TaskId:55)
E:\USERS\A.USER.ORG\DEVEL\TEMP\RELEASE\EDITOR\STDAFX.OBJ (TaskId:55)
C:\PROGRAMDATA\NVIDIA CORPORATION\DRS\NVDRSDB0.BIN was modified at 23-Feb-12 12:08:20. (TaskId:55)
stdafx.cpp will be compiled. (TaskId:55)
...
Tracking command: (TaskId:55)
C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\Tracker.exe ... stdafx.cpp /clr:nostdlib (TaskId:55)
stdafx.cpp (TaskId:55)
Done executing task "CL". (TaskId:55)
One of the workarounds is to add the irrelevant files to C++ ignore list:
<ItemGroup>
<ClNoDependencies Include="NVDRSDB0.BIN" />
<ClNoDependencies Include="C:\PROGRAMDATA\NVIDIA CORPORATION\DRS\NVDRSDB0.BIN" />
</ItemGroup>
Unfortunately this doesn't help :( And I didn't yet check how this trick works on other PCs, where such files don't exist.
So the question remains: is anybody aware of the working solution for this problem?
I didn't try installing SP1 for VS2010 - according to enthusiast this step doesn't help either.
Disabling NVIDIA update service may probably help (it will stop updating the file), but there are or may be other software which cannot be disabled this way (antivirus, other utilities, etc.).
See also related questions:
发布评论
评论(3)
我也有同样的问题,除了我的情况下的“修改”文件是
微软已经承认存在一个错误(将在下一个版本中修复)和建议的解决方法
http://connect.microsoft.com/VisualStudio/feedback/details/715572/unexpected-rebuild-of-projects
http://connect.microsoft.com/VisualStudio/feedback/details/649139/vs2010-does-complete-rebuild-based-on-completely-unlated-file
但这些都没有到目前为止为我工作。我仍在尝试修改我的
文件并将类似以下内容添加到我的属性表中,
但到目前为止我还没有运气。也许您可以让这个解决方法为您工作? (如果有的话请告诉我!)
I have this same problem, except that the "modified" file in my case is
Microsoft has admitted there is a bug (which will be fixed in the next release) and suggested workarounds
http://connect.microsoft.com/VisualStudio/feedback/details/715572/unexpected-rebuild-of-projects
http://connect.microsoft.com/VisualStudio/feedback/details/649139/vs2010-does-complete-rebuild-based-on-completely-unrelated-file
but none of these has worked for me so far. I'm still trying to muck with my
file and add something like the following to my property sheets
but I have had no luck so far. Perhaps you can get this work-around to work for you? (Let me know if it does!)
我们在使用 Sophos
CONFIG.BOPS
文件时遇到了同样的问题。我们有一个庞大的团队,我们的解决方案有 80 多个项目,因此其他人描述的解决方法对我们来说没有吸引力。我采取了一种效果很好的方法。有些人可能会说这完全是一个黑客行为,我承认确实如此,但它非常简单,而且在微软修复这个问题之前它目前仍然有效。我用 C# 编写了一个小型桌面托盘应用程序,用于监视 CONFIG.BOPS 文件,每当时间戳发生变化时,它都会使用 File.SetLastWriteTime 将其设置回旧日期,而无需修改文件内容。该应用程序必须在 Windows 7 上以管理员身份运行,但这对我们来说很好,因为我们的员工都对其 PC 拥有管理员权限。我们没有 NVDRSDB0.BIN 问题,但我怀疑它也适用于这种情况。
We had the same problem with the Sophos
CONFIG.BOPS
file. We have a large team and our solution has 80+ projects, so the workaround described by others was unappealing to us. I took an approach that has worked beautifully. Some may say that it's a total hack, which I'll admit it is, but it's incredibly simple and it works for now until Microsoft fixes this.I wrote a tiny desktop tray app in C# that monitors the
CONFIG.BOPS
file, and whenever the timestamp changes, it sets it back to an old date usingFile.SetLastWriteTime
without modifying the file contents. The app must be run as administrator on Windows 7, but that's fine for us as our staff all has admin rights to their PCs. We don't have theNVDRSDB0.BIN
problem, but I suspect it could work for that case as well.通过将 C:\PROGRAMDATA\NVIDIA CORPORATION\DRS\ 添加到我的用户属性表 VC++ 目录/排除目录中,我能够摆脱此问题。
要编辑此文件,请打开“视图”->“属性管理器”,它将位于每个项目/配置下。
如果您不想在系统范围内执行此操作,您可以创建一个新的属性表并将其仅添加到您需要设置它的项目中。您可以在属性管理器中多选所有需要此设置的项目,然后右键单击->添加新属性表。
I was able to get rid of this problem by adding C:\PROGRAMDATA\NVIDIA CORPORATION\DRS\ to my user property sheet VC++ Directories/Exclude Directories.
To edit this file, open View->Property Manager it will be under every project/configuration.
If you don't want to do this system wide you can create a new property sheet and add it just to the projects you need to set it for. You can multi-select all the projects you need this set for in the Property Manager and right click->Add New property Sheet.