注意:
- 此功能仅适用于 VS 2008 及更低版本。
本节介绍如何使用 IncrediLink 选项来加速 Visual Studio .NET、2005 和 2008中的增量链接。
概述
IncrediLink 选项可以将增量链接从几分钟加速到几秒钟。 它通过组合 Visual Studio 的增量链接选项和修改 link.exe 命令行,以便在可行时将 LIB 文件的引用替换为构成该 LIB 文件的 OBJ 文件引用,从而完成此操作。 为了使增量链接功能在由 LIB 项目(这些项目链接到主项目中)组成的solutions中有效,后一种修改是必需的。
启用 IncrediLink
要打开 IncrediLink,在Agent设置的 Visual Studio 构建项下链接器页面选择“By default, enable IncrediLink”选项。
当此选项选中时,有两种模式可用:
- 根据“Enable Incremental Linking”项目设置 - 在此模式下,IncrediLink 将仅对已启用“增量链接”的项目激活。 请注意,由于增量链接已默认启用,因此未专门禁用增量链接的所有项目都将包括在内。
- 对于所有项目 - 在此模式下,IncrediLink 将对所有项目激活。
- “Do not create libraries”复选框控制 IncrediBuild 是否会为已被 IncrediLink 将其 OBJ 文件嵌入父项目的链接命令行的 LIB 项目跳过链接步骤。 由于这些 LIB 项目的 OBJ 文件已被链接到主可执行文件/DLL,因此您通常可以通过避免这些 LIB 项目的链接步骤来节省更多的构建时间。
对于 Visual Studio 2005/2008 构建,您可以在标准操作模式(“根据 IncrediBuild 默认设置”)和“根据‘使用库依赖项输入’项目选项”设置之间进行选择,后者将导致 IncrediLink 仅对于已在其项目属性设置中激活了此设置的项目而激活(“使用库依赖项输入”属性是 Visual Studio 2005/2008 相对于 IncrediLink 的等效设置)。
注意:
- IncrediLink 仅影响 DLL 和 EXE 项目的链接。
注意事项
开启此功能需要考虑以下几点:
- 如果不同的库项目重复定义相同的符号,则可能会显示“重复符号”链接错误消息。 这是因为相比于在不同目标文件中定义的重复符号,链接器更能容许存在于多个库中的重复符号。 如果发生这种情况,请更改代码以使每个符号仅容许一次定义。
- 可能显示“缺少函数体”链接错误。 要解决此问题,请将函数体存根添加到代码中。
- 代码中未引用的符号仍将包含在最终输出中(带有普通链接,将被忽略)。
Visual Studio 参考:
Batch Build Configurations
Accelerating Custom Build Steps, Build Events, and Build Tools
C# Acceleration
Using IncrediBuild for Visual Studio 2010 and Later
Further VS Build Performance Optimizations
Visual Studio 2008 and Earlier
IncrediBuild Solutions 简介:
Visual Studio Solution
Make and Other Build Tools Solution
DevTools Solution
IncrediBuild for Qt Creator
IncrediBuild For Game Development
IncrediBuild for Unit Tests
Working with Build Groups
Running Gitlab Builds with Incredibuild
用户手册:
List of Open Sources
Getting Started
Set Up and Installation
IncrediBuild Solutions
The Coordinator
IncrediBuild Agents
IncrediBuild Cloud
Working from Home
Troubleshooting Issues
IncrediBuild Additional Resources
Release Notes