简体   繁体   English

Windows 7和Windows Server 2008 R2中的不同WinSxS行为

[英]Different WinSxS behaviour in Windows 7 and Windows Server 2008 R2

I've got an executable who's manifest says it depends on 我有一个可执行文件,显示它依赖于它

Microsoft.VC90.CRT 9.0.21022.8
Microsoft.VC90.CRT 9.0.30729.1

On Windows 7, this executable runs with no problem. 在Windows 7上,此可执行文件运行没有问题。 On Windows Server 2008 R2, this executable fails to run with the message: 在Windows Server 2008 R2上,此可执行文件无法与以下消息一起运行:

The application has failed to start because its side-by-side configuration is incorrect. 应用程序无法启动,因为它的并排配置不正确。 Please see the application event log or use the command-line sxstrace.exe tool for more detail. 有关更多详细信息,请参阅应用程序事件日志或使用命令行sxstrace.exe工具。

This was unexpected - I thought Windows 7 and Windows Server 2008 R2 should be very similar regarding runtime availability. 这是出乎意料的 - 我认为Windows 7和Windows Server 2008 R2在运行时可用性方面应该非常相似。 Both machines are pretty clean. 两台机器都很干净。 The Windows 7 machine is a fresh installation with nothing on it. Windows 7机器是一个全新的安装,没有任何东西。 The Windows Server 2008 R2 machine only has some updates from Windows Update. Windows Server 2008 R2计算机仅具有Windows Update的一些更新。

I checked the Windows 7 machine's WinSxS directory and found 我检查了Windows 7机器的WinSxS目录并找到了

Microsoft VC90.CRT 9.0.30729.4926

I checked the Windows Server 2008 R2 machine's WinSxS directory and found 我检查了Windows Server 2008 R2机器的WinSxS目录并找到了

Microsoft VC90.CRT 9.0.30729.4926

The runtime that is present is newer than what is specified in the manifest and yet the Windows Server 2008 R2 system fails to redirect to the newer runtime. 存在的运行时比清单中指定的更新,但Windows Server 2008 R2系统无法重定向到较新的运行时。 Running sxstrace on Windows Server 2008 R2 shows: 在Windows Server 2008 R2上运行sxstrace显示:

INFO: Applying Binding Policy
    INFO: No publisher policy found.
    INFO: No binding policy redirect found.

Running sxstrace on Windows 7 gives: 在Windows 7上运行sxstrace可以:

INFO: Applying Binding Policy
    INFO: Find publisher policy at C:\Windows\WinSxS\manifest\amd64...
    INFO: Publisher Policy redirected assembly version.
    INFO: Post policy assembly identity is...

Any ideas how this could be resolved besides installing the VS 2008 runtime and the VS 2008 SP1 runtime? 除了安装VS 2008运行时和VS 2008 SP1运行时之外,还有什么想法可以解决这个问题? I thought the whole idea of the assemblies was that it allowed the system to override the older runtimes and substitute the newer ones. 我认为程序集的整个想法是它允许系统覆盖较旧的运行时并替换较新的运行时。

You can put the VC++ runtime dlls in your application's executable directory and it should work. 您可以将VC ++运行时dll放在应用程序的可执行文件目录中,它应该可以工作。 You'll need the 2 dll's (MSVCR and MSVCP) and the manifest as well. 您还需要2 dll(MSVCR和MSVCP)和清单。 Off the top of my head just putting all 3 of those files in the application's executable directory should do the trick 只需将所有这三个文件放在应用程序的可执行文件目录中就可以了

Although in principle WinSxS allows compatible newer versions of assemblies to replace older versions, the VS runtimes do not make use of this functionality, and bind only to the same version they were compiled against. 虽然原则上WinSxS允许兼容的较新版本的程序集替换旧版本,但VS运行时不使用此功能,并且只绑定它们编译的相同版本。 Either recompile all components of your application against the same version of the library (probably best, to avoid problems with multiple malloc heaps) or install both runtimes. 要么针对相同版本的库重新编译应用程序的所有组件(可能最好,以避免多个malloc堆的问题)或安装两个运行时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM