How to solve the problem for VS2005 CRT loading for application compiled with older runtime than the

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
We are compiling our VS2005 libraries against CRT version="8.0.50727.762". When our customers are trying to load our libraries dynamically at runtime, windows SXS loads the latest runtime installed on the system lets say "8.0.50727.4027" and not the version
8.0.50727.762 that i compiled my libraries against for the particular publicKeyToken="1fc8b3b9a1e18e3b". According to the publishers Policy mentioned at "C:WINDOWSWinSxSPoliciesx86_policy.8.0.Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_x-ww_77c24773*.policy"
file the runtime should map to the latest version 8.0.50727.4027.
In order to make sure that our application always loads with correct runtimes, I created a private manifest file, in which i removed the publicKeyToken and attached that manifest with our application. They way when windows looks for the runtime libraries,
it can not find the public folder to look for runtime and it looks for the runtime at the current folder where the dll and exe files are present. I found that information at the following link.
http://blog.kalmbachnet.de/?postid=80 http://blog.kalmbachnet.de/?postid=80
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/523f3e64-aa12-4fcc-bb7f-3aade9b188ac/ http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/523f3e64-aa12-4fcc-bb7f-3aade9b188ac/
All I needed to do is to ship the actual ms runtimes with our packages, so on customers end it doesnt look for the runtime at the public folders. I was happy with this solution but there was one more problem.
I found out that some of our customers do not want to put the MS runtimes with our dlls, and they always install the Vsredist_.exe on the system for the runtime libraries. Now I am again back to the same situation that I have to make sure our DLL find the
exact same runtime at the public folder and loads with them only and not with the latest runtime installed on the system.
I have two questions now.

1. How can I setup my manifest file that everytime the application look for runtime libraries, it find the libraries with the version that I have mentioned in my manifest file. For example, If my manifest has this information
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b </assemblyIdentity>
Our application should only load the runtime with version 8.0.50727.762 and should not look for the higher version installed on the system.
I have already tried by using <publisherPolicy apply="no"/> element inside the assemblyIdentity element but it doesnt help. I am not able to run our application.exe file after adding that tag. Please let me know if there is a right way to add this
element in the manifest. I have already followed the msdn direction.
2. If I want to keep my old solution that remove the publickeytoken from private manifest and ship the runtimes with our packages, how do i solve the problems for the customers who do not want to ship the runtimes with our dlls.
Is there a way that when the customer tries to load our dll, our dll should first look for the runtime dlls in the current folder and if not found then go to the public folders i.e. c:windowswinsxs.. .
I hope my questions are clear. Please let me know if you have any doubt about the question. I need to solve this runtime side by side dynamic loading issue asap.
Thanks a lot for any help you can give me.
Ashish
<br/>
<br/>
<br/>

View the full article
 
Back
Top