windows - 用本地配置文件替换 Microsoft.VC90.CRT WinSxS 策略文件

标签 windows visual-c++ manifest config winsxs

在 Windows XP 上,我有一个以 msvcp90.dll 运行的 .exe , msvcr90.dll , 和 Microsoft.VC90.CRT.manifest在我的本地应用程序目录中。我在 C:\WINDOWS\WinSxS\Policies 中也有这些 .dll 的策略文件,由 Visual C++ 2008 SP1 Redistributable Package 安装.我想删除此策略文件并改用本地目录中的应用程序配置文件。策略文件是:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity type="win32-policy" name="policy.9.0.Microsoft.VC90.CRT" version="9.0.30729.1" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/>
            <bindingRedirect oldVersion="9.0.20718.0-9.0.21022.8" newVersion="9.0.30729.1"/>
            <bindingRedirect oldVersion="9.0.30201.0-9.0.30729.1" newVersion="9.0.30729.1"/>
        </dependentAssembly>
    </dependency>
</assembly>

我的配置文件是:

<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
            <dependentAssembly>
                <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/>
                <bindingRedirect oldVersion="9.0.20718.0-9.0.21022.8" newVersion="9.0.30729.1"/>
                <bindingRedirect oldVersion="9.0.30201.0-9.0.30729.1" newVersion="9.0.30729.1"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

Dependency Walker 在使用配置文件而不是策略文件时同时报告错误 - 有什么问题吗?另外,配置文件应该命名为<application>.exe.config吗? , 或 Microsoft.VC90.CRT.config

(澄清一下,使用策略文件时没有出现错误。但是,这里的客户端不允许安装可再分发包。

MSDN docs声明应用程序配置文件可以重定向应用程序以使用同一程序集的不同版本 ( per-application configuration ),并且如果需要它可以覆盖现有的策略(发布者配置)文件。所以我认为必须可以使用本地应用程序配置文件,并且上面文件中的某些内容丢失或不正确。)

最佳答案

您的配置数据在 <runtime> 下节点。它应该在 <windows> 下节点。

我必须提醒您,强烈建议不要发送包含绑定(bind)重定向的应用程序配置文件,这适用于处理他们管理的机器上的应用程序兼容性问题的系统管理员。应用程序开发人员应该改为编写他们的应用程序以使用他们所依赖的特定 CRT 版本的最新修订版,并使用该版本附带的默认全局策略。

事实上,从 Windows 2003 开始​​,在应用程序配置文件中使用绑定(bind)重定向需要应用程序兼容性数据库中的条目。

关于windows - 用本地配置文件替换 Microsoft.VC90.CRT WinSxS 策略文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7508433/

相关文章:

c++ - 读取应用程序的 list 文件?

c - GCC警告没有强制转换,而MSVC警告有强制转换,为什么?

无法打开 Windows 命名管道进行写入?

c++ - Visual C++ 中的容错 DLL 使用

c++ - 写入文件,给出不正确的名称

c++ - win7 + vc7.1 + mfc = 计算器

c++ - 在xml中获取子节点的名称将返回#text C++

android - android.permission.SET_PROCESS_LIMIT 在 android 应用程序中的用途是什么?

java - 在 list 文件中设置主类的路径

c++ - 如何使用 Windows native Wifi 功能连接到请求网络安全 key 的 Wifi?