Jeffrey Lott
Jeffrey Lott

Reputation: 7419

Overwriting dlls in MEF

Right now, I'm trying to separate out a set of constantly changing classes into their own dll and dynamically load them using MEF. My problem is that whenever I try and overwrite the dll while the app is running, it says it's in use.

Is there anyway to configure MEF to let me overwrite the dll and pick up the changes while the app is still running?

Upvotes: 2

Views: 2281

Answers (2)

TomTom
TomTom

Reputation: 62093

This is not an MEF issue - it is your appdomain standard setup that locks the DLL's touched. Check http://www.vistax64.com/powershell/26164-reflection-assembly-loadfile-locks-file.html for a similar issue not involveind MEF.

Basically, do not run on the dll's, make a copy first and work on the copy ;)

Check http://bartdesmet.net/blogs/bart/archive/2006/07/29/4146.aspx for the AppDomain ShadowCopy mechanism ;)

Upvotes: 4

Jon Skeet
Jon Skeet

Reputation: 1500335

I suspect it will work if you completely unload any AppDomain which currently references the DLL.

Upvotes: 2

Related Questions