指导 VC++应用程序使用较旧的 VC80.CRT 版本

发布于 2024-08-18 05:29:04 字数 1353 浏览 3 评论 0原文

我有一个 VC++ 托管应用程序,它是针对 VC80.CRT 版本 8.0.50727.762 构建和测试的。我验证了嵌入式清单指向 762,并且构建机器的最新 VC80.CRT 版本为 762。

该应用程序现在也可以在具有 762 以及更高版本的运行时 (4053) 的计算机上运行。

顺便说一下,两台机器都是 XP Pro SP2;第二台机器(可以说是 4053)具有 .NET 3.0。

该应用程序在 4053 机器上运行,我想我明白,由于 SxS 下的 VC80.CRT 附带的发布者策略,该应用程序为应用程序加载 4053 而不是 762 。

由于各种我不想深究的原因,我一直试图强制它使用762版本,到目前为止还没有成功。

无论如何,在研究了文献之后,我想我理解了确定要加载的目标版本的链:app config ->出版商政策 ->机器配置。

因此,我将 myapp.exe.config 文件(见下文)放置在 myapp.exe 附近;请注意将publisherPolicy 设置为“no”以避免链接的第二步。

该应用程序仍然加载 4053,而不是 762。也许这是由于机器配置文件所说的内容,但我什至无法开始弄清楚该文件的内容应该意味着什么 - 当然没有任何对 VC80 的引用.CRT 或任何 msvc[x]80.dll 库。

我预计引用旧版本的程序集会相对容易,这是克服“dll 地狱”的关键——即使程序集发布者希望保证向后兼容性(通过发布者策略)。
任何人都可以阐明吗? 谢谢

<configuration>
    <runtime>    
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b">
                 </assemblyIdentity>
                 <publisherPolicy apply="no" />
                 <bindingRedirect oldVersion="*" newVersion="8.0.50727.762"/>
             </dependentAssembly>
         </assemblyBinding>
   </runtime>
</configuration>

I have a VC++ managed app that was built and tested against VC80.CRT version 8.0.50727.762. I verified that the embedded manifest points to 762, and the build machine has 762 as the latest VC80.CRT version.

The app has now been also run on a machine that has both 762 as well as a later version of the runtimes (4053).

Both machines, incidentally, are XP Pro SP2; the second machine (the 4053 so to speak) has .NET 3.0.

The app works on the 4053 machine, and I think I understand that due to the Publisher Policy that accompanies the VC80.CRT under the SxS, the app loads 4053 for the application rather than 762 .

For various reasons that I don't want to get into, I've been trying to force it to use the 762 version, so far without success.

At any rate, after researching the literature, I think I understand the chain that determines the target version to load: app config -> publisher policy -> machine config.

So I've come down to placing the myapp.exe.config file (see below) near myapp.exe; note the setting of publisherPolicy to "no" to avoid the second step of the chaining.

The app still loads 4053, rather than 762. Perhaps it's due to what the machine config file says, but I can't even begin to figure out what that file's contents are supposed to mean -- certainly there isn't any reference to VC80.CRT or any of the msvc[x]80.dll libs there.

I expected that referring to an older version of an assembly would be relatively easy to do, being key to overcome 'dll hell' -- even if the assembly publisher feels like guaranteeing backward compatibility (via the publisher policy).
Can anyone shed light?
Thanks

<configuration>
    <runtime>    
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b">
                 </assemblyIdentity>
                 <publisherPolicy apply="no" />
                 <bindingRedirect oldVersion="*" newVersion="8.0.50727.762"/>
             </dependentAssembly>
         </assemblyBinding>
   </runtime>
</configuration>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傲性难收 2024-08-25 05:29:04

Machine.config 适用于 .NET 应用程序。本机 SxS 配置位于 WinSxS 目录中。

您的 EXE 是否有嵌入式清单?自 XP SP2(我认为)以来,这些文件优先于外部(foo.exe.manifest)文件。

Machine.config is for .NET apps. Native SxS configuration is in the WinSxS directory.

Does your EXE have an embedded manifest? Since XP SP2 (I think) these take precedence over external (foo.exe.manifest) files.

夜血缘 2024-08-25 05:29:04

标记用于 CLR 依赖项。对于本机 SxS,请使用 。另外,我不相信有适用于 SxS 的机器配置,仅适用于 GAC/CLR。

请参阅我对相关问题的回答:
怎么做我强制本机应用程序使用较旧的 C 运行时

The <runtime> tag is for CLR dependencies. Use <windows> for native SxS. Also, I don't believe there is a machine config for SxS, only for the GAC/CLR.

See my answer to my related question:
How do I force a native application to use an older C runtime

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文