【问题标题】:Multiple projects in a Visual Studio solution with same dependencies produce different pdb sizes具有相同依赖项的 Visual Studio 解决方案中的多个项目会产生不同的 pdb 大小
【发布时间】:2019-07-08 20:47:38
【问题描述】:

我有一个包含 170 个项目的 Visual Studio 解决方案。这些项目中的大多数被用作几个主要项目的依赖项。

这些主要项目包括完整版和精简版。让我们说 product_full_link 和 product_lite_link。

这两个项目具有相同的项目依赖关系,只是配置不同,只是稍微限制了程序之间的可用功能。

当我构建解决方案时,它会构建 product_full_link,然后是 product_lite_link。 product_full_link 的 .pdb 文件最终约为 1GB。 product_lite_link 的 .pdb 文件在收到错误消息之前达到约 4GB。

1>LINK : fatal error LNK1201: error writing to program database 'C:\project\Debug\product_lite_link.pdb'; check for insufficient disk space, invalid path, or insufficient privilege

这些项目之间的所有链接器选项都是相同的。我尝试使用多个链接选项来减小 .pdb 大小,包括此处描述的所有方法 https://blogs.msdn.microsoft.com/vcblog/2014/03/05/shrink-my-program-database-pdb-file/ 无济于事。

我还尝试独立于 product_full_link 项目构建 product_lite_link 项目,但它仍然会生成巨大的 .pdb 文件并产生相同的错误消息,而 product_full_link 项目始终使用可管理的 .pdb 成功构建。

任何有关管理多项目解决方案的帮助或参考资料都会有很大帮助。

【问题讨论】:

  • 你说两个项目中的code是一样的吗?
  • 是的,代码是一样的。它们的不同之处在于它们的预处理器指令限制了精简版中的可用功能。

标签: visual-studio projects-and-solutions pdb-files


【解决方案1】:

我找到了我的问题的解决方案。

问题在于项目之间的链接器选项不同。

这些是我的 product_full_link.vcxproj 中的链接器选项

<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
  <Link>
    <AdditionalDependencies>product_full_configuration_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
    <HeapReserveSize>0x10000000</HeapReserveSize>
    <HeapCommitSize>0x10000</HeapCommitSize>
    <LargeAddressAware>true</LargeAddressAware>
    <ShowProgress>NotSet</ShowProgress>
    <TargetMachine>MachineX64</TargetMachine>
    <GenerateDebugInformation>DebugFull</GenerateDebugInformation>
    <FullProgramDatabaseFile>true</FullProgramDatabaseFile>
  </Link>
</ItemDefinitionGroup>

这些是我的 product_lite_link.vcxproj 中的链接器选项

<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
  <Link>
    <AdditionalDependencies>product_full_configuration_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
    <TargetMachine>MachineX64</TargetMachine>
  </Link>
</ItemDefinitionGroup>

问题在于 Visual Studio > 项目属性 > 链接器 中的选项显示的选项与 .vcxproj 文件中的选项不同,因此我无法识别其中的差异。 p>

不过,我不确定,这些选项中的哪一个有助于减少 .pdb 文件大小。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-02
    • 1970-01-01
    • 2020-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-13
    相关资源
    最近更新 更多