Reputation: 36016
I created a simple Win32 application to demonstrate UXtheme on XP by including a manifest dependency on the ver 6 commctl32.dll
I then created a simple Win32 dll, built it with ISOLATION_AWARE_ENABLED
, and tested it with an embedded manifest specifying both version 5 and 6 of Comctl32.dll
I successfully got the exe and dll to use different versions of comctl32.dll using this method. Both with the exe using 5 and the dll version 6, and the other way around.
Then, I reset the app AND the dll to have a comctl ver 5 manifest dependency. And introduced an application configuration file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
<windows>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" processorArchitecture="amd64" publicKeyToken="6595b64144ccf1df"/>
<bindingRedirect oldVersion="5.82.7100.0" newVersion="6.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</windows>
</configuration>
Now, when I run my application, the applications is clearly being redirected to commctl v6 - dialogs are clearly displayed using the XP UXTheme enabled. However, the dll is not being redirected and is using the non themed ver 5 of commctl.
There is no mention of per-dll config files for doing bindingRedirects in the documentation. And trying to create one does not do anything.
I do also know that doing a bindingRedirect from one major version of an assembly to another is not a supported scenario, but Im really just using commctl32 as an obvious easy way to test the mechanics.
How do I redirect the version of a dependent assembly of a dll?
Upvotes: 3
Views: 2461
Reputation: 41
And Windows Vista won't even access .manifest or .config files that are added later as it caches their existence along with a date-time stamp for the exe.
I've found that logging off/on seems to clear the triggers the config file to be read again.
Upvotes: 4
Reputation: 36016
So, this question has been answered.
After all that I discovered that LoadLibrary does probe for a .config file when loading dlls:
full_path_to_dll\dllname.dll.2.config
Binding redirects in this file will be processed.
Upvotes: 3