1

Referencing this question: System.Reflection.Assembly.LoadFile Locks File
System.IO.File.ReadAllBytes(path) wont work since it's not a standalone lib, it has many dependencies. This solution ( http://www.eggheadcafe.com/software/aspnet/35494668/shadow-copies-how.aspx ) won't work either, since I'm writing a Visual Studio addin, and I have no access to a Main method. The second answer here ( Can I make the default AppDomain use shadow copies of certain assemblies? ) won't work either, since the problem described in comment, I need to be able to repeatedly reload the given assembly and always see the most fresh version, yet I still must be able to rebuild the assembly without quiting the Visual Studio instance which runs my addin.

What are my options?

Community
  • 1
  • 1
TDaver
  • 7,164
  • 5
  • 47
  • 94
  • 1
    Good luck, make sure you wear a bulletproof vest, you are heading for a dangerous neighborhood. – leppie Jan 12 '11 at 15:33
  • Use two instances of Visual Studio, one to build, another to test. Restart the 2nd one as needed. – Hans Passant Jan 12 '11 at 15:55
  • currently using a workaround: moved the code loading the assembly into a console exe, and copied the exe to a fixed location (set from addin config), and I'm calling AppDomain.ExecuteAssembly on that fixed location and then unloading that AppDomain... (and that appdomain uses shadowcopy just to be safe :)) – TDaver Jan 12 '11 at 16:18

1 Answers1

0

My original comment turned permanent solution:
moved the code loading the assembly into a console exe, and copied the exe to a fixed location (set from addin config), and I'm calling AppDomain.ExecuteAssembly on that fixed location and then unloading that AppDomain... (and that appdomain uses shadowcopy just to be safe :))

TDaver
  • 7,164
  • 5
  • 47
  • 94