我想减少我的VS.NET项目的编译时间 - 你有什么想法如何做到这一点?我的、我想、这一点、你有什么

2023-09-03 17:29:58 作者:时光磨忆

我的项目是开发在Visual Studio 08,在C#。这是一个独立的桌面应用程序,大约60K行code。 曾几何时我喜欢这方面的工作的软件 - 现在的compliation时间已经增长到约2分钟,就变成了远不如愉快的经历......

My project is developed in Visual Studio 08, in C#. It's a standalone desktop application, about 60k lines of code. Once upon a time I loved working on this software - now that the compliation time has grown to approx 2 minutes, it becomes a far less enjoyable experience...

我觉得我在C#中的经验不足可能是一个因素;我所研制的一切在一个命名空间 - 例如将有一个结构良好的codeBase的使编译器重新编译的code只有必要的部分更改时?或者,我需要的部分分离成单独的项目/ DLL文件来强制这种情况发生?

I think that my lack of experience in C# may be a factor; I have developed everything under one namespace for example - would having a well structured codebase enable the compiler to recompile only the necessary parts of the code when changes are made? Or do I need to separate sections into separate projects/DLLs to force this to happen?

如何的差多少会升级到最新的四核处理器做什么呢?

How much of a difference would upgrading to the latest quad-core processor make?

另一个想法是,也许这是一个典型的事情程序员来处理 - 是一个漫长的编译时间这样简单的东西,必须加以管理。

The other thought is, perhaps this is a typical thing for programmers to deal with - is a long compile time like this simply something that must be managed?

在此先感谢。

推荐答案

我很惊讶,60K线code需要2分钟进行编译。我有一个应用程序,为50万线code,而且只需要大约一分半钟。请确保你是不是每次都做全面的重建,并确保你没有清洗溶液之间的基础之上。一个正常的构建应执行增量生成,只有重新编译自上次编译已经改变了code(以及任何受这种变化。)

I'm surprised that 60k lines of code take 2 minutes to compile. I have an application that is 500,000 lines of code, and it only takes about a minute and a half. Make sure you are not doing full rebuilds each time, and make sure you are not cleaning the solution between builds. A normal build should perform an incremental build, only recompiling code that has changed since the last build (along with anything affected by that change.)

或许一些其他的因素可能包括大量使用大资源(图片),在最低水平库广泛翻天覆地的变化(即所使用的一切),等等。一般来说,一个比较现代的机器上,编制60000对C#code线应比平均分少取,除非你是重建整个解决方案。

Perhaps some other factors might include heavy use of large resources (images?), broad-sweeping changes in the lowest level libraries (i.e. those used by everything else), etc. Generally speaking, on a relatively modern machine, compiling 60,000 lines of C# code should take less than a minute on average, unless you are rebuilding the entire solution.