微软可再发行包
我正在开发一个使用 2 个库的软件。 这2个库都使用VS2005并且都需要VS2005 redist包。 然而,他们的 redist 包是不同版本的。 所以,我有几个关于安装 redists 的问题。
1)我可以直接安装新版本吗? 2)如果我安装这两个redist,Windows如何知道哪个库正在使用哪个redist?
谢谢
I am developing a software that uses 2 libraries.
These 2 libraries both use VS2005 and both need VS2005 redist package.
However, their redist package are in different version.
So, I have several questions about installing the redists.
1) Can I just install the newer version without problem?
2) If I install these two redists, how Windows knows which library is using which redist?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从XP开始,DLL被(或可以)安装在Windows并行缓存中(事实上,VS2005的DLL坚持在并行缓存中找到;否则它们拒绝运行)。
在 Windows 并行缓存(您可以在 C:\WINDOWS\WINSxS 中找到)中,DLL 被放置在子文件夹中,由名称和版本标识。这样,多个版本的 DLL 就可以并行安装。
如果编译 Visual Studio 应用程序,编译器将告诉链接器它应该生成一个清单文件。然后可以使用 MT 命令将该清单文件链接到可执行文件或 DLL 中。
此清单文件包含与前面所述相同的版本号,Windows 将在加载可执行文件或 DLL 时使用此信息来定位要加载的 DLL。
在您的问题中,不清楚您使用的 2 个库是 DLL 还是 LIB。
如果它们是 DLL,则使用上述系统,您可能不会有任何问题。
您仍然可以尝试安装较新的版本,但如果 Windows 抱怨,安装旧版本也是安全的。
但是,如果您使用 LIB,则可能会遇到麻烦。无法指示每个 LIB 使用的 DLL。您的可执行文件只能引用一个 DLL(实际上是 DLL 的一个版本),而不是两个。
在这种情况下,您可以做的是检查并排缓存中的策略。您可以在 C:\WINDOWS\WINSxS\Policies 中找到它。每个组件将有一个子文件夹,文件夹中将包含策略文件。策略文件可以指定重定向,因此如果您的应用程序需要版本 X,则策略可以包含也允许版本 Y 的信息。
这是一个策略文件的示例:
有关更多详细信息,请在 MSDN 上查找有关并排缓存以及如何使用清单文件的信息。
Starting from XP, DLL's are (or can be) installed in the Windows side-by-side cache (in fact, the VS2005 DLL's insist on being found in the side-by-side cache; otherwise they refuse to be run).
In the Windows side-by-side cache (which you can find in C:\WINDOWS\WINSxS) the DLL's are put in sub folders, identified by a name and a version. That way, multiple versions of the DLL's can be installed side-by-side.
If you compile a Visual Studio application, the compiler will tell the linker that it should generate a manifest file. This manifest file can then be linked in the executable or DLL using the MT command.
This manifest file contains the same version number as described before, and Windows will use this information to locate the DLL's to load when loading an executable or DLL.
In your question it is not clear whether the 2 libraries that you use are DLL's or LIB's.
If they are DLL's the system described above is used and you will probably have no problems.
You could still try to install the newer version, but if Windows complains it is safe to install the older version as well.
However, if you are using LIB's you could be in trouble. There is no way to indicate the DLL's to use per LIB. Your executable can only refer to one DLL (actually one version of the DLL), not two.
What you could do in this case is check the policies in the side-by-side cache. You will find this in C:\WINDOWS\WINSxS\Policies). There will be a sub folder per component and in the folders will be policy files. The policy files can specify redirects, so if your application expects version X, the policy can contain information that also version Y is allowed.
This is such an example of a policy file:
For more details, look on MSDN for information about the Side-by-side cache and how to use manifest files.