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

查看:164
本文介绍了是否有在运行时验证动态程序集的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:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ peverify.dll(或c :\ WINDOWS \ Microsoft.NET \框架\ V2.0.50727 \ peverify.dll为CLR 2.0),这是一个的本机的DLL(实际上,peverify.exe也是本机)

It seems that peverify.exe is a front-end to c:\Windows\Microsoft.NET\Framework\v4.0.30319\peverify.dll (or c:\Windows\Microsoft.NET\Framework\v2.0.50727\peverify.dll for CLR 2.0), which is a native DLL (actually, peverify.exe is also native)

我没有看到这个记录的任何地方,所以它可能不是一个公共的API。您可能能够找出从该DLL使用像的Dependency Walker 导出的功能,但我认为它会更简单,只是打电话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.

编辑:传闻:

  • 在编译器的步骤,嘘实际上是调用peverify.exe
  • <一个href="https://github.com/rsdn/nemerle/blob/master/snippets/$c$cgentests/Tests/Verification/PeVerify.cs">Nemerle在它的测试要求peverify.exe 。
  • <一个href="https://github.com/castleproject/Core/blob/master/src/Castle.Core.Tests/BasePEVerifyTestCase.cs">Castle.DynamicProxy在它的测试要求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天全站免登陆