是否有用于在运行时验证动态程序集的 MSIL 的 API? [英] Is there an API for verifying the MSIL of a dynamic assembly at runtime?

查看:18
本文介绍了是否有用于在运行时验证动态程序集的 MSIL 的 API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行时使用 Reflection.Emit 构建程序集时,我想在保存到磁盘之前验证程序集 MSIL.像 PEVerify 但在运行时.有这样的API吗?

When using Reflection.Emit to build an assembly at runtime, I'd like to verify the assembly MSIL before saving to disc. Like PEVerify but at runtime. Is there such an API?

推荐答案

看来 peverify.exe 是 c:WindowsMicrosoft.NETFrameworkv4.0.30319peverify.dll(或 c:WindowsMicrosoft.NETFrameworkv2.0.50727peverify.dll for CLR 2.0),这是一个native DLL(实际上,peverify.exe也是native)

It seems that peverify.exe is a front-end to c:WindowsMicrosoft.NETFrameworkv4.0.30319peverify.dll (or c:WindowsMicrosoft.NETFrameworkv2.0.50727peverify.dll for CLR 2.0), which is a native DLL (actually, peverify.exe is also native)

我在任何地方都没有看到此文档,因此它可能不是公共 API.您也许可以使用 Dependency Walker 之类的东西找出该 DLL 的导出函数,但我认为它会调用 peverify.exe 更简单.

I don't see this documented anywhere so it's probably not a public API. You may be able to figure out the exported functions from that DLL using something like Dependency Walker, but I think it would be simpler to just call peverify.exe.

轶事证据:

  • In a compiler step, Boo actually calls peverify.exe.
  • Nemerle calls peverify.exe in its tests.
  • Castle.DynamicProxy calls peverify.exe in its tests.

这篇关于是否有用于在运行时验证动态程序集的 MSIL 的 API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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