views:

30

answers:

1

Hi,

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

A: 

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:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright © 1981-2001 Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

    <assemblyIdentity type="win32-policy" name="policy.8.0.Microsoft.VC80.ATL" version="8.0.50727.4053" processorArchitecture="amd64    " publicKeyToken="1fc8b3b9a1e18e3b"/>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity type="win32" name="Microsoft.VC80.ATL" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"    />
            <bindingRedirect oldVersion="8.0.41204.256-8.0.50608.0" newVersion="8.0.50727.4053"/>
             <bindingRedirect oldVersion="8.0.50727.42-8.0.50727.4053" newVersion="8.0.50727.4053"/>
        </dependentAssembly>
    </dependency>

</assembly>

For more details, look on MSDN for information about the Side-by-side cache and how to use manifest files.

Patrick