如何将程序集保存到磁盘? [英] How to save assembly to disk?

查看:29
本文介绍了如何将程序集保存到磁盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将程序集保存到文件?IE.我的意思不是动态程序集,而是正常"的内存程序集.

How I can save assembly to file? I.e. I mean not dynamic assembly but "normal" in-memory assemblies.

Assembly[] asslist = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly ass1 in asslist)
{
    // How to save?
}

当应用程序从资源加载一些引用的程序集时,就会发生这种情况.我想将它们保存到磁盘.

This situation can occur when the application loads some referenced assemblies from resources. I want to save them to disk.

不可能从资源中提取程序集,因为它们在那里加密.

It is impossible to extract assemblies form resources because they are encrypted there.

推荐答案

您需要找到程序集的来源路径.你可以这样找到它:

You need to find the path your assemblies came from. You can find it like this:

Assembly ass = ...;
return ass.Location;

请注意,as 是关键字,不能用作标识符.我推荐使用 ass.

Notice, that as is a keyword and cannot be used as an identifier. I recommend using ass.

这篇关于如何将程序集保存到磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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