加载和装配没有锁定文件的执行code? [英] Load and execute code from an assembly without locking the file?

查看:154
本文介绍了加载和装配没有锁定文件的执行code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从磁盘加载程序集,并没有得到锁定在磁盘上的文件再执行code?我永远无法理解为什么必须锁定文件,因为code将在RAM中加载和JIT编译的?

Is there a way to load an assembly from disk and execute code in it without getting the file locked on disk? I never understood why it is necessary to lock the file since the code will be loaded in RAM and JIT-compiled?

推荐答案

这是可能的,你可以使用的的Assembly.Load(byte []的)以加载程序集,以及。该程序集不具有加载上下文,可以反复加载它。管理这可是不容易的,你一定会找到答案。

It's possible, you can use Assembly.Load(byte[]) to load an assembly as well. That assembly doesn't have a "loading context", you can load it repeatedly. Managing this is however not easy, you're bound to find out.

这篇关于加载和装配没有锁定文件的执行code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆