Visual Studio 2008不断重建 [英] Visual Studio 2008 keeps rebuilding

查看:98
本文介绍了Visual Studio 2008不断重建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
Visual Studio会不断构建所有内容

Possible Duplicate:
Visual Studio keeps building everything

Visual Studio 2008不断重建整个项目,就像修改每个实现文件一样.即使没有文件被修改,也会发生这种情况.按两次生成按钮,整个项目将被重建两次.在另一个盒子上不会发生这种情况.该操作系统是Windows Vista.

Visual Studio 2008 keeps rebuilding the entire project as if every implementation file was modified. This happens even if no files were modified. Hit build button twice in row, and the entire projects gets rebuild twice. This doesn't happens on another box. The OS is Windows Vista.

这很烦人.什么可能导致这种行为?

This is very annoying. What could cause such a behavior?

这是一个C ++项目.

It is a C++ project.

推荐答案

一些想法可以尝试...

Some ideas to try...

正如@David Paxson在评论中说的那样,使用某些语言(例如C#,VB),所有项目似乎都是构建的",但是编译器将跳过不需要构建的项目即使它们仍在输出中列出,也可以快速进行.因此,可能只是出现即可重建所有内容.另外,使用C#,Visual Studio有时会连续运行该项目几次,有时它会以无明显的理由决定需要重建"项目,但这通常只需要花费几秒钟的时间,除非您有数百个项目.项目.

As @David Paxson said in the comments, with some languauges (e.g. C#, VB) all the projects will appear to be "built", but the compiler will skip through the ones that don't need to be built much more quickly, even though they are still listed in the output. So it may simply appear to be rebuilding everything. Also, with C#, Visual Studio sometimes runs the project several times in a row, and sometimes it will decide for no obvious reason that it needs to "rebuild" the projects, but this only usually takes a few seconds extra unless you have hundreds of projects.

重新启动Visual Studio(甚至完全重新启动PC).

Restart Visual Studio (or even reboot the PC entirely).

对整个解决方案进行全部重建"以清除所有旧的缓存信息,并确保所有输出文件都是最新的.

Do a "Rebuild All" of the entire solution to clean out any old cached information and ensure all the output files are up to date.

如果您使用源代码管理,那么更好的方法是检入所有更改,然后删除旧的源代码文件夹(或更安全的做法是,将其重命名为某个地方,直到您知道不需要它为止),然后再次从源代码管理中强制获取所有最新的源代码.这意味着您有一个完全干净的起点(不幸的是,一个干净的或重建的东西并不能完全清理掉所有内容).我每2-4周进行一次此操作,以使所有操作均平稳运行,并与源代码完全同步.

If you use source control, then even better is to check in all of your changes, then delete your old source code folder (or safer, rename it somewhere out of the way until you know you don't need it) and force-get all the latest source code from source control again. This means you have a totally clean starting point (a clean or rebuild-all doesn't quite clean everything away, unfortunately). I do this every 2-4 weeks to keep everything running smoothly and totally in sync with the Source Control code.

如果任何内容修改了构建中任何文件的日期戳,则可能会触发需要"来重建所有内容.检查系统时钟设置是否正确,是否没有将源文件的日期戳设置为将来"的时间,是否有正在运行的应用程序可能会触摸"您的任何源文件.

If anything modifies the datestamps of any files in your build, then this could trigger a "need" to rebuild everything. Check that your system clock is set correctly, that there aren't any datestamps of source files set to times "in the future", and there are no applications running that could possibly "touch" any of your source files.

选中此选项:工具->选项>项目和解决方案>生成并运行:仅生成启动项目和对运行的依赖项".如果未选中,则VS会尝试每次都重建所有项目,而不仅仅是重建启动项目的依赖项.如果您有一个大型解决方案,其中包含许多不相关的项目,那么这是设置的非常有用的选项.

Check this option: Tools->Options > Projects and Solutions > Build and Run : "Only build startup projects and dependencies on Run". If it is unchecked, then VS will try to rebuild all projects every time, rather than only the dependencies of the startup project. If you have a large solution with a bunch of mostly unrelated projects in it, this is a very helpful option to set.

如果不需要每次都构建某些项目,请使用配置管理器禁用当前构建中这些项目的构建(或创建"Debug Fast Build"(调试快速构建)配置,以便您可以在完全重建和部分重建).或将不需要经常构建的项目移到单独的库"解决方案中,并从应用程序的解决方案中引用/链接输出文件(obj或dll),因此仅当您编辑其代码时才需要重建这些库.

If there are projects that you don't need to build every time, then use the Configuration Manager to disable building of those projects in your current build (or create a "Debug Fast Build" configuration so you can switch quickly between a full rebuild and a partial build). Or move projects that don't need to be built often into a separate "libraries" solution and reference/link the output files (obj or dll) form your application's Solution, so the libraries only need to be rebuilt if you edit their code.

最后,请确保您正在执行构建"而不是重建":-)

Lastly, make sure you're doing a "Build" and not a "Rebuild" :-)

这篇关于Visual Studio 2008不断重建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆