Search code examples
windowsside-by-sidewinsxssxs

How to remove uninstalled DLL from SxS cache


I had VS 2008. I upgraded to VS 2010, and uninstalled VS 2008.

I have a test that runs on my machine, but fails to load on machines in the build lab. After some debugging, I realized that the test executable still had a dependency on msvcr90d.dll (which is a VC++ 2008 debug runtime library). Even though I had uninstalled VS 2008, the test works on my machine because that runtime DLL still exists in the side-by-side cache (%windir%/winsxs). The build lab machine doesn't have the DLL, so it won't load there.

Shouldn't uninstalling VS 2008 have caused all of its runtime DLLs to be removed from the side-by-side cache?

Is there a way I can manually remove these old DLLs from the side-by-side cache? I'd like to be able to easily detect other places where I might still have an out-of-date dependency.


Solution

  • You first need to take ownership of the containing folder. All the folders there will be owned by SYSTEM or TrustedInstaller. So do this:

    Right click->Properties->Security tab->Advanced->Owner tab->Edit->Select yourself as owner->tick 'Replace owner on subcontainers and objects->OK

    Once you've done that, you can do Right click->Properties->Security tab->Give yourself full control->OK

    Or if you're familiar with the cacls command you can do it from the command line.

    Once you've got full control you can move the folder, which I highly recommend over deleting it. Deleting files from winsxs is likely to break other applications or even Windows.