使用Assembly查询文件Version信息后,如何关闭

ZalmanR 2012-05-22 03:59:52
我使用Assembly查询文件的Version等信息,使用了如下代码:

string filepath = @"D:\testfiles\test\d.dll";
string newfilepath = @"D:\testfiles\new\d.dll";

Assembly assembly = Assembly.LoadFile(filepath);

但是之后,我想讲newfilepath的内容copy到filepath,使用代码:

File.Copy(newfilepath, filepath, true);

这时发生异常:
"
The process cannot access the file 'D:\testfiles\test\d.dll' because it is being used by another process.
"
我查看了assembly和Assembly(静态方法)好像都没有类似FileStream那样提供Close()等方法,请问我要如何做才能让assembly释放掉对文件的操作呢?谢谢
...全文
153 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ZalmanR 2012-05-22
  • 打赏
  • 举报
回复
之前的提问在这里:
http://topic.csdn.net/u/20100729/09/a24b2dfd-bcb9-4a5b-a259-bda35d1a2a43.html
ZalmanR 2012-05-22
  • 打赏
  • 举报
回复
看到之前有人提问过了。。。刚才搜索assembly没搜索到。。。
有人来接分么?
cnfixit 2012-05-22
  • 打赏
  • 举报
回复
http://hi.baidu.com/sukun/blog/item/ac278218192c4abd4aedbcfa.html

http://blog.sina.com.cn/s/blog_3c5d99ea0100gq6k.html

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧