• <bdo id='D5E4E'></bdo><ul id='D5E4E'></ul>
    <tfoot id='D5E4E'></tfoot>

    <small id='D5E4E'></small><noframes id='D5E4E'>

    <legend id='D5E4E'><style id='D5E4E'><dir id='D5E4E'><q id='D5E4E'></q></dir></style></legend>
    <i id='D5E4E'><tr id='D5E4E'><dt id='D5E4E'><q id='D5E4E'><span id='D5E4E'><b id='D5E4E'><form id='D5E4E'><ins id='D5E4E'></ins><ul id='D5E4E'></ul><sub id='D5E4E'></sub></form><legend id='D5E4E'></legend><bdo id='D5E4E'><pre id='D5E4E'><center id='D5E4E'></center></pre></bdo></b><th id='D5E4E'></th></span></q></dt></tr></i><div id='D5E4E'><tfoot id='D5E4E'></tfoot><dl id='D5E4E'><fieldset id='D5E4E'></fieldset></dl></div>

      1. 如何选择应用程序应链接到的 VC 2008 DLL 版本?

        How to select the version of the VC 2008 DLLs the application should be linked to?(如何选择应用程序应链接到的 VC 2008 DLL 版本?)

          <small id='a8yFD'></small><noframes id='a8yFD'>

              <tbody id='a8yFD'></tbody>

              <legend id='a8yFD'><style id='a8yFD'><dir id='a8yFD'><q id='a8yFD'></q></dir></style></legend>
            1. <i id='a8yFD'><tr id='a8yFD'><dt id='a8yFD'><q id='a8yFD'><span id='a8yFD'><b id='a8yFD'><form id='a8yFD'><ins id='a8yFD'></ins><ul id='a8yFD'></ul><sub id='a8yFD'></sub></form><legend id='a8yFD'></legend><bdo id='a8yFD'><pre id='a8yFD'><center id='a8yFD'></center></pre></bdo></b><th id='a8yFD'></th></span></q></dt></tr></i><div id='a8yFD'><tfoot id='a8yFD'></tfoot><dl id='a8yFD'><fieldset id='a8yFD'></fieldset></dl></div>
            2. <tfoot id='a8yFD'></tfoot>

                <bdo id='a8yFD'></bdo><ul id='a8yFD'></ul>
                  本文介绍了如何选择应用程序应链接到的 VC 2008 DLL 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我使用的是 Visual Studio 2008 SP1 for C++.编译时,Visual Studio 需要选择应链接应用程序的 CRT 和 MFC DLL 版本,版本 9.0.21022.8(= RTM)、9.0.30729.17(= SP1)或 9.0.30729.4148(= 带有安全更新的 SP1).我想知道您如何选择将链接到两个版本中的哪一个.有人知道吗?

                  I'm using Visual Studio 2008 SP1 for C++. When compiling, Visual Studio needs to choose against which version of the CRT and MFC DLLs the application should be linked, version 9.0.21022.8 (= RTM), 9.0.30729.17 (= SP1) or 9.0.30729.4148 (= SP1 with security update). I'd like to know how you can choose which of both versions will be linked against. Does anyone know?

                  注意:这在使用 私有程序集,因为您需要知道要与 .exe 一起复制哪些版本的 VC 9.0 DLL.

                  Note: this is important when using a private assembly, because you need to know which versions of the VC 9.0 DLLs to copy along with the .exe.

                  注意 _BIND_TO_CURRENT_VCLIBS_VERSION 标志仅确保清单中包含正确的版本.运行时的 DLL 版本选择显然不是基于清单文件中包含的版本完成的.即使清单文件说应该使用 v21022,.exe 也会使用 v30729 .DLL.我知道这一点,因为它使用了 std::tr1::weakptr,它在 v21022 中不存在.

                  Note that the _BIND_TO_CURRENT_VCLIBS_VERSION flag only makes sure that the right version is included in the manifest. The DLL version selection at runtime is apparently not done based upon the version that is included in the manifest file. Even if the manifest file says that v21022 should be used, the .exe uses the v30729 .DLLs. I know this, because it uses std::tr1::weakptr, which is not present in v21022.

                  推荐答案

                  _BIND_TO_CURRENT_VCLIBS_VERSION 设置清单中的当前版本 - 如果不是,则设置 RTM 版本.并将其设置在清单中是正确的做法.

                  _BIND_TO_CURRENT_VCLIBS_VERSION sets the current version in the manifest - or the RTM version if not. And setting it in the manifest is the correct way to do this.

                  然而,您看到的是程序集策略文件的效果:- 当安装了包含 2008 SP1 运行时的 VCRedist 包时,它会将策略文件安装到 WinSxS 存储中,其中包含一个 bindingRedirect 条目,该条目重定向尝试加载 RTM运行时到 SP1 运行时.

                  What you are seeing however is the effects of an assembly policy file :- When the VCRedist package containing the 2008 SP1 runtime is installed, it installs a policy file into the WinSxS store with a bindingRedirect entry that redirects attempts to load the RTM runtime to the SP1 runtime.

                  因此,在其清单中指定 RTM 运行时的应用程序将加载 SP1 运行时,而指定 SP1 运行时的应用程序将加载 SP1 运行时.

                  So applications that specify the RTM runtime in their manifest will load the SP1 runtime, and applications that specify the SP1 runtime, will load the SP1 runtime.

                  如果您确实想使用 RTM 运行时,即使安装了 SP1 运行时和策略文件,您也需要在清单中指定 RTM 版本,并使用应用程序配置文件.基本上是yourappname.exe.config"(或yourdllname.dll.2.config",如果它是一个导致悲伤的隔离感知 dll).应用程序配置文件可以提供一个 bindingRedirect 元素,该元素覆盖清单或策略文件中指定的任何程序集版本.

                  If you actually DO want to use the RTM runtime, even when the SP1 runtime and policy files are installed, then you need to specify the RTM version in your manifest, AND make use of an application configuration file. Basically "yourappname.exe.config" ( or "yourdllname.dll.2.config" if its an isolation aware dll causing grief). Application congifuration files can supply a bindingRedirect element that overrides any assembly version specified in the manifest, or policy files.

                  即使安装了 SP1 运行时,此配置文件也会告诉操作系统加载 RTM 运行时:-

                  This config file will tell the OS to load the RTM runtime even if the SP1 runtime is installed :-

                  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                  <configuration>
                      <windows>
                          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                              <dependentAssembly>
                                  <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/>
                                  <bindingRedirect oldVersion="9.0.30729.1" newVersion="9.0.21022.8"/>
                              </dependentAssembly>
                          </assemblyBinding>
                      </windows>
                  </configuration>
                  

                  注意:oldVersion 可以是一个范围:oldVersion="9.0.30729.1-9.1.0.0"

                  Note: oldVersion is allowed to be a range: oldVersion="9.0.30729.1-9.1.0.0"

                  请参阅:应用程序配置文件记录在MSDN.

                  See: Application Configuration Files documented on MSDN.

                  这篇关于如何选择应用程序应链接到的 VC 2008 DLL 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C++ stl unordered_map implementation, reference validity(C++ stl unordered_map 实现,参考有效性)
                  C++: Is it possible to use a reference as the value in a map?(C++:是否可以使用引用作为映射中的值?)
                  Where ampersand quot;amp;quot; can be put when passing argument by reference?(其中符号“amp;通过引用传递参数时可以放置吗?)
                  Why can a non-const reference parameter be bound to a temporary object?(为什么可以将非常量引用参数绑定到临时对象?)
                  What is a dangling reference?(什么是悬空引用?)
                  C++ reference changes when push_back new element to std::vector(当 push_back 新元素到 std::vector 时,C++ 引用发生变化)
                  <i id='8BWFU'><tr id='8BWFU'><dt id='8BWFU'><q id='8BWFU'><span id='8BWFU'><b id='8BWFU'><form id='8BWFU'><ins id='8BWFU'></ins><ul id='8BWFU'></ul><sub id='8BWFU'></sub></form><legend id='8BWFU'></legend><bdo id='8BWFU'><pre id='8BWFU'><center id='8BWFU'></center></pre></bdo></b><th id='8BWFU'></th></span></q></dt></tr></i><div id='8BWFU'><tfoot id='8BWFU'></tfoot><dl id='8BWFU'><fieldset id='8BWFU'></fieldset></dl></div>
                  <tfoot id='8BWFU'></tfoot>

                    <bdo id='8BWFU'></bdo><ul id='8BWFU'></ul>
                      <tbody id='8BWFU'></tbody>
                      <legend id='8BWFU'><style id='8BWFU'><dir id='8BWFU'><q id='8BWFU'></q></dir></style></legend>

                      1. <small id='8BWFU'></small><noframes id='8BWFU'>