如何使用 CCI 或 Mono.Cecil 从头开始创建新的 Windows Phone 7 程序集
我正在开发一个为 WP7 生成程序集的工具。我正在从完整的框架中进行此操作。由于 Reflection.Emit 不适用于 WP7,但 CCI 或 Mono.Cecil 可以,我想知道是否有一种方法可以从头开始创建新程序集。我已经知道我可以修改现有的程序集,但能够创建一个程序集将非常有用。 我想解决方法是在 Visual Studio 中生成一个空程序集并将其保留为模板,但我认为应该有更好的方法。
I am working on a tool to generate assemblies for WP7. I am doing this from the full framework. Since Reflection.Emit doesn't work with WP7 but either CCI or Mono.Cecil do I am wondering if there is a way to create new assemblies from scratch. I already know that I can modify existing assemblies, but being able to create one would be pretty useful.
I guess a workaround would be to generate an empty assembly in visual studio and keep it as a template, but I think that there should be a better way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Mono.Cecil 非常容易做到:
有几点需要注意:
It's pretty easy to do with Mono.Cecil:
A few things to note:
值得指出的是,虽然您可以使用备用框架从手机运行时生成动态程序集,但您无法加载/执行它们。如果由应用程序代码执行,这些 API 将引发异常。
It's worth pointing out that while you may be able to generate dynamic assemblies from within the phone's runtime using alternate framework's, you're not goint to be able to load / execute them. Those APIs will throw an exception if executed by application code.