开发者

Windows update breaks dlls?

开发者 https://www.devze.com 2022-12-28 00:30 出处:网络
I\'m compiling a project which uses multiple DLL and compiles with VS2008. After a recent windows update DLLs compiled on my computer stopped working on other computers.

I'm compiling a project which uses multiple DLL and compiles with VS2008. After a recent windows update DLLs compiled on my computer stopped working on other computers.

After some investigation it turned out that it updated the CRT redistributable library which I'm compiling with from version "9.0.21022.8" to version "9.0.30729.4148"

This is evident from the Manifest file of the EXE i'm compiling. it contains the following:

  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.4148" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>

Meaning it wants to use two different versions of the CRT at the same time. the second version is needed by the code which I'm compiling right now and the first version is needed by older dlls which were compiled a few weeks ago.

In the computers where the application is deployed this becomes a problem since they get their CRT dll from a local folder called Microsoft.VC90.CRT and not from WinSXS. This folder can't contain two different versions of the dll.

Is there a kno开发者_JAVA百科wn solution to this issue or do I need to start compiling all of the other DLLs with the new CRT?


This is one of the many headaches caused by Side-by-Side Assemblies. Any time there is an update for Visual Studio, you really need to recompile all your code. Because there was a version change in the CRT, some of your code is using one DLL and the rest is using another.

Also, when distributing, you really need to distribute the CRT through merge modules or the appropriate installation set instead of copying the DLL's into the application folder. This will allow the program to look up the appropriate runtime(s) through WinSxS.

Finally, if you want to remove the problem altogether, like I did, you can modify all your projects to link statically with the CRT and recompile everything. This will completely remove the dependency on the runtime DLL - at least, with your own code. No more WinSxS to worry about here.

0

精彩评论

暂无评论...
验证码 换一张
取 消