visual-studio 每次运行 Visual Studio 时如何修复“项目已过期”消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/909533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to fix visual studio 'projects out of date' message each time I run it
提问by hamishmcn
I have a visual studio (2005) solution file with 70 projects.
Each time I press F5 to run it, it tells me that 4 of the projects are out of date, and asks me if I want to rebuild them. It does this even though I have just done a full build.
I understand (in principle) that one of the other projects must update something that these projects depend on, but how do I go about finding out what?
我有一个包含 70 个项目的 Visual Studio (2005) 解决方案文件。
每次按 F5 运行它时,它都会告诉我其中 4 个项目已过期,并询问我是否要重建它们。即使我刚刚完成了完整的构建,它也会这样做。
我理解(原则上)其他项目之一必须更新这些项目所依赖的东西,但我如何去找出什么?
Are there any tools to help, or what procedure should I follow to figure out what is causing VS to flag these projects for a rebuild?
是否有任何工具可以提供帮助,或者我应该遵循什么程序来找出导致 VS 标记这些项目以进行重建的原因?
UPDATE:
For those interested it looks like my PC was/is the problem (my HD has been acting up recently). As I tried to track down the problem successive rebuilds started generating compile errors. I did a clean-and-build and got a huge number of (obviously spurious) errors. One reboot later, followed by a rebuild, all the errors and the dependency problem have gone away.
Excuse me now, while I go and back-up all my important files...
更新:
对于那些感兴趣的人来说,我的电脑似乎是/是问题(我的 HD 最近一直在运行)。当我试图追踪问题时,连续的重建开始产生编译错误。我做了一个清理和构建并得到了大量(显然是虚假的)错误。重新启动后,然后重建,所有错误和依赖性问题都消失了。
对不起,我去备份我所有的重要文件......
采纳答案by John Saunders
I would run a normal Build, twice in a row. The second time, I'd set the MSBUILD verbosity to "Normal" or higher (in Tools->Options, "Projects and Solutions", "Build and Run". I'd read the output carefully to see what gets actually built the second time.
我会连续两次运行正常的构建。第二次,我将 MSBUILD 详细程度设置为“正常”或更高(在工具->选项、“项目和解决方案”、“构建和运行”中。我会仔细阅读输出以查看实际构建的内容第二次。
In fact, now that I think of it, if this really is a cycle, then some part of what gets built the second time must be what's causing it to build the third time, etc. Perhaps you have a post-build step in one of the projects that touches an assembly or other resource used as input to an earlier step. With 70 projects in the solution, something like this would be easy to cause inadvertently, and hard to catch. You may have to learn enough about MSBUILD to be able to detect when one of its steps is deciding it needs to build because something changed, then to understand your solution well enough to know that nothing should have changed; then to see that something haschanged that should not have changed.
事实上,现在我想起来,如果这真的是一个循环,那么第二次构建的某些部分一定是导致它第三次构建的原因,等等。也许你有一个构建后的步骤涉及用作早期步骤输入的程序集或其他资源的项目。解决方案中有 70 个项目,这样的事情很容易在不经意间引起,而且很难捕捉。您可能需要对 MSBUILD 有足够的了解,以便能够检测到它的步骤之一何时决定它需要构建,因为某些事情发生了变化,然后充分理解您的解决方案以知道什么都不应该改变;然后看到的东西已经改变了,不应该有所改变。
When you're done with this exercise, you may have gained some insight that will enable you to help in breaking the solution into smaller solutions.
完成此练习后,您可能获得了一些见解,可以帮助您将解决方案分解为更小的解决方案。
回答by Jgranth
I had the same problem with linking a .netmodule into my project that was complied with a custom build step. The prolem turned out to be that I was also linking a C++ lib and the .netmodule file was listed on the same line in the linker input.
我在将 .netmodule 链接到符合自定义构建步骤的项目时遇到了同样的问题。问题是我还链接了一个 C++ 库,并且 .netmodule 文件列在链接器输入的同一行上。
Example: .lib .netmodule
示例:.lib .netmodule
Insead of: .lib \n .netmodule
代替: .lib \n .netmodule
回答by Ruud van Gaal
A quicker way than John's log verbosity in Visual Studio 2013, is to open the Solution Explorer's project tree; the files which were not found won't have the little triangle in front of the filename (with which you normally can see a list of symbols in that file).
在 Visual Studio 2013 中,比 John 的日志详细程度更快的方法是打开解决方案资源管理器的项目树;未找到的文件在文件名前面不会有小三角形(您通常可以看到该文件中的符号列表)。
Remove those files and for me, the AlwaysCreate message went away (you only see 'AlwaysCreate' when the verbose level is set to at least 'Normal').
删除这些文件,对我来说,AlwaysCreate 消息消失了(当详细级别至少设置为“正常”时,您只会看到“AlwaysCreate”)。
回答by heck0fan3ngin3r
I had this problem and it turned out I had a header file added to my project but that I had deleted from the disk. Removing the non-existent header file from the fixes the behavior.
我遇到了这个问题,结果我在我的项目中添加了一个头文件,但我已经从磁盘中删除了它。从修复行为中删除不存在的头文件。
回答by Logicrat
I had this exact problem in VS2010 after I deleted some source files that were no longer used in my project. Simply selecting "Clean Solution" from the "Build" menu and then rebuilding the solution fixed the problem for me.
在我删除了一些不再在我的项目中使用的源文件后,我在 VS2010 中遇到了这个确切的问题。只需从“构建”菜单中选择“清洁解决方案”,然后重建解决方案即可为我解决问题。

