MMC .Net 运行时版本
我目前正在开发一个 MMC 管理单元,但遇到了一个大障碍 - 它是使用 .Net 4.0 框架完成的; 并且 MMC 正在加载运行时的早期版本。
使用旧版本的运行时并不是真正的选择,因为整个项目是为 4.0 编写的(到目前为止 5000 LOC); 这只是一个管理前端(想象一下:P)。
我检查了 MMC 注册表项,它的版本为 v4.0.20506。 我在任何地方都找不到任何其他 MMC .Net 互操作配置。
有任何想法吗?
I am currently developing an MMC snap-in but have hit a big snag - it's done using the .Net 4.0 framework; and MMC is loading a previous version of the runtime.
Using an older version of the runtime isn't really an option, as the entire project is written for 4.0 (so far 5000 LOC); this is merely a management front-end (fancy that :P).
I checked the MMC registry key and it has version v4.0.20506 there. I can't find any other MMC .Net interop configuration anywhere.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
进一步阅读了这个问题后,我可以确认主机进程必须通过 .NET 4.0 中的一些新 API。
我怀疑 MMC(即使在 Windows 7 中)是否支持这些 API,因为 .NET 4.0 也处于测试阶段。 万一出现这种情况,您可以通过在配置中使用supportedRuntime 元素来强制它使用它:
但是,如果做不到这一点,恐怕您就不走运了。 那么您唯一的选择就是将您的项目更改为面向 .NET 2.0。
或者,您可以编写一个非托管 MMC 管理单元,托管其自己的运行时并加载您的托管管理单元。 您有多需要这些 .NET 4.0 功能?
Having read up on the matter a bit further, I can confirm that the host process must explicitly support multiple runtimes via some new APIs in .NET 4.0.
I doubt MMC (even in Windows 7) supports these APIs, since .NET 4.0 is also in beta. In the unlikely chance that it does, you can force it to use it by using the supportedRuntime element in your configuration:
Failing that, however, I'm afraid you are out of luck. Your only choice then will be to change your project to target .NET 2.0.
Alternatively, you could write an unmanaged MMC snap-in that hosts it's own runtime and loads your managed one. How badly do you need those .NET 4.0 features?
...或者您可以强制 MMC 使用 v4.0 和以下环境变量:
...or you can force MMC to use v4.0 with following environment variable:
Microsoft 此后发布了有关 MMC 和 CLR 版本的文章 http://msdn.microsoft.com/en-us/library/windows/desktop/gg983006(v=vs.85).aspx
基本上,您创建一个神奇的环境变量,将 CLR 启动引导到特定于 MMC 管理单元的配置文件。
就我个人而言,我认为如果他们只是将 MMC.EXE 更改为使用 CLR 4,那么每个人的生活都会变得更轻松,但由于某种原因,他们决定不朝这个方向发展。
Microsoft has since posted this article regarding MMC and CLR versions http://msdn.microsoft.com/en-us/library/windows/desktop/gg983006(v=vs.85).aspx
Basically, you create a magical environment variable that directs the CLR startup to a configuration file that is specific to your MMC snap-in.
Personally, I think it would have made everyone's lives easier if they would have simply changed MMC.EXE to use CLR 4 but for some reason they decided to not go that direction.