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?
Reflection.Emit
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)
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.
EDIT: anecdotal evidence:
1.4m articles
1.4m replys
5 comments
57.0k users