开发者

Assembly.LoadFrom locks assembly file

开发者 https://www.devze.com 2023-02-03 16:37 出处:网络
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.

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?


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 :))

0

精彩评论

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

关注公众号