23

I have this assembly that for some reason Windows started to load from this path:

C:\Users\marius\AppData\Local\assembly\dl3\MP6PT6BV.2Z4\GMRQEZL9.LCB\46d762c5\8cf066ff_7eaecc01\X.DLL

That means whatever changes I do to the assembly, the new copy of it isn't loaded from its output folder but from that cached folder. I tried deleting the folder, even restarting Windows, it is generated again and the assembly loaded from there.

So, how can I get rid of it? What do I have to do to tell the system to load the DLL from its output folder and not from the cache?

Marius Bancila
  • 16,053
  • 9
  • 49
  • 91
  • This was also the cause of a bug in the upcoming VS 11 as can be seen here: http://stackoverflow.com/q/10159828/114029 Thanks for posting this question! :D – Leniel Maccaferri Apr 25 '12 at 16:39

1 Answers1

28

I found the answer to my question. That is the "shadow copy" folder for the .NET framework as specified in Windows Registry under HKCU\Software\Microsoft\Fusion\DownloadCacheLocation. Shadow copying is a feature in the .NET framework to allow assemblies used in an app domain to be updated without unloading the app domain. More about this feature in MSDN http://msdn.microsoft.com/en-us/library/ms404279.aspx.

The app domain where I was loading the assembly was configured to shadow copy files, by setting the ShadowCopyFiles property to true.

Marius Bancila
  • 16,053
  • 9
  • 49
  • 91
  • You must make sure `ShadowCopyFiles` is false if you don't want to use the feature. – Marius Bancila Jun 06 '12 at 08:24
  • 6
    @MariusBancila How do you set that to false? I've been trying all sorts of ways to do this, and none seem to work. Is there a setting in VS or is there some other way? – Erick Oct 17 '13 at 19:00
  • 1
    @MariusBancila where to set ShadowCopyFiles to false in Visual Studio? – Hossein Narimani Rad May 16 '14 at 12:09
  • @Erick: Seems to be a runtime thing? https://msdn.microsoft.com/en-us/library/system.appdomainsetup.shadowcopyfiles.aspx – Mooing Duck Apr 02 '15 at 17:58
  • @MooingDuck I tried that and never got it to work. That's why I asked. Never got that to work and am now working elsewhere. But if you do find it, please post it for others. – Erick Apr 02 '15 at 21:15
  • I logged in with another user and still have shadow copy problems. therefore it is not unique to the current user registry key. – hamish May 18 '15 at 22:01