在VS2010中构建解决方案时,如何仅自动编译已更改的项目?

在VS2010中构建解决方案时,如何仅自动编译已更改的项目?

问题描述:

我正在我公司的大型解决方案上进行TDD开发,我们使用Visual Studio 2010,我遇到了编译时间长的问题,因为每次我仅对一个文件进行小的更改时,它都会编译整个解决方案,

I am doing TDD development on a large solution in my company, we use visual studio 2010, I have the problem of long compile time, because it compiles the whole solution each time I do a small change in only one file, It compile very often so slows me down.

有没有办法告诉VS2010仅编译已更改的项目或解决我问题的其他方法,我们有20个项目在解决方案内部,我在编写代码时经常碰到2-3个。

Is there a way to tell VS2010 to compile only the project that has changed or some other solution to my problem, we have 20 projects inside the solution, I often touch 2-3 of them when I code.

谢谢。

签出 NCrunch 。 NCrunch在键入时会不断检查代码,并让您知道每一行代码是否至少包含一个测试,以及覆盖该代码的测试是否通过。当您进行更改时,NCrunch只会对受更改影响的代码进行后台编译。

Check out NCrunch. NCrunch constantly checks the code as you are typing, and lets you know whether each line of code is covered by at least one test, and whether or not the tests covering it pass. NCrunch does background compiling of just the code that is impacted by your changes, as you make them.

此操作无需停止并手动编译(甚至保存) !)您的代码。只需编写测试代码,然后编写生产代码,您将立即或几乎如此(当然,取决于测试的速度和隔离程度)。

This is done without your need to stop and manually compile (or even save!) your code. Just write the test code, and then write your production code and you will instantaneously or nearly so (depending, of course, on the speed and isolation of your tests) how you're doing.