C#项目的原因在Visual Studio重建 [英] Reasons for C# projects to rebuild in Visual Studio

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

问题描述

我有一个大的解决方案,一些320个项目中,即使在很长的构建时间变化小到一个Web表单结果测试/调试一个小的变化。我怀疑生成后的文件复制任务'感人'文件日期时间,造成多次翻修。

是否还有其他原因VS 2010中运行重建比源文件日期比二进制输出文件的更新,在没有任何强有力的命名和版本等影响?

附录:我对源代码树的大小或形状没有直接影响。这是一个稳定的核心产品和任何短期的主干非经营性的变化被认为是危险的,或昂贵。我会提高答案中提到我点这里接收输入到该项目的未来发展方向。


解决方案

C#重建因为文件已被更改,或者依赖已被更改,也频频对没有明显的理由。你经常可以建立连续2〜3次而不做一个改变,C#将曲折行进关闭,重建大量的code的。

打开工具>选项>项目和解决方案>生成和运行>只有建立在运行启动项目和依赖关系。这将最大限度地减少构建只打算来执行,所以除非一切都是一台庞大的依赖关系树项目的依赖,这将显著减少在构建考虑项目的数量。

更好的解决方案,但是,是避免要求它摆在首位进行编译。


  • 每个项目都增加了额外的开销构建。在我的电脑,这是3秒左右。通过合并两个项目的code到一个.csproj的文件,我节省建造时间3秒。因此,对于300 +项目,你可以只通过合并项目敲钟落生成时间 - 即在可能使用多个模块/一组装,而不是许多组件的命名空间。你会发现你的应用程序的启动时间也得到改善。


  • 许多项目并不需要建设所有的时间。打破这些作为出库项目,只是链接到(参考)二进制文件


  • 通过避免使320 320份的DLL都在你的硬盘驱动器,这将显著降低开销

    -
  • 另外,请禁用复制本地,而是指所有OutputPaths到共享文件夹。

  • 添加新的生成配置(例如调试的FastBuild),只有建立您实际工作的组件。随着configguration经理,你可以取消勾选你不想建项目,preSTO,它们被构建系统忽视。当您从源头控制得到code,建立一个完整的调试打造刷新一切,然后再切换回的FastBuild


I have a large solution, of some 320 projects, where even small changes to a single web form result in long build times to test/debug a small change. I suspect post-build file copy tasks for 'touching' file datetimes and causing multiple rebuilds.

Are there any other reasons for VS 2010 to run a rebuild other than source files being newer than binary output files, in the absence of any strong naming and versioning influences?

ADDENDUM: I have no immediate influence on the size or shape of the source tree. It is the trunk of a stable core product and any short-term "non-business" changes are considered risky and or costly. I will raise points mentioned in answers I receive here as input to future directions of the project.

解决方案

C# rebuilds because a file has been changed, or a dependency has been changed, but also frequently for "no obvious reason". You can often build 2 or 3 times in a row without making a single change and C# will trundle off and rebuild vast amounts of the code.

Turn on Tools > Options > Projects and Solutions > Build and Run > Only build startup projects and dependencies on run. This will minimise the build to only the dependencies of the project you intend to execute, so unless everything is one massive dependency tree, this will significantly reduce the number of projects considered in the build.

The better solution, however, is to avoid asking it to compile in the first place.

  • Every project adds an additional overhead to the build. On my PC this is around 3 seconds. By merging the code of two projects into one .csproj files I save 3 seconds of build time. So for 300+ projects you could knock 10 minutes off the build time just by merging projects - i.e. where possible use many modules/namespaces in one assembly rather than many assemblies. You'll find your application startup time is improved too.

  • Many projects don't need building all the time. Break these out as library projects and just link to (reference) the binaries

  • Also disable "copy local" and instead point all OutputPaths to a shared folder - this will significantly reduce the overheads by avoiding making 320 copies of 320 dlls all over your hard drive.

  • Add new build configurations (e.g. "Debug FastBuild") that only build the assemblies you are actually working on. With the configguration manager you can untick projects you don't want to build, and presto, they are ignored by the build system. After you get code from source control, build a full "Debug" build to refresh everything, and then switch back to "fastbuild"

这篇关于C#项目的原因在Visual Studio重建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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