繁体   English   中英

MMC SnapIn和.Net 4.x.

[英]MMC SnapIn and .Net 4.x

我们最近将所有项目升级到Visual Studio 2012和.Net 4.5。 我们的大多数项目都有自定义MMC管理单元来处理产品配置。 我现在已经知道MMC 3.0本身并不处理.Net 4.0运行时,因为运行时MMC 3.0发布后运行时间很长。

我正在寻找一种方法来修复我们的管理单元,以便MMC在加载时不会崩溃,而且我遇到了许多提及添加mmc.exe.config文件的页面。 我试过这个,我无法让它发挥作用。

我创建了一个文件,其内容如下:

<configuration>
  <startup>
    <supportedRuntime version='v4.0.20506' />
    <requiredRuntime version='v4.0.20506' safemode='true' />
  </startup>
</configuration>

我已将其保存为windows \\ system32和windows \\ sysWOW64目录中的mmc.exe.config,但此文件的存在没有区别。 我的snapins仍然崩溃,并显示相同的错误消息:

Could not load file or assembly 'xxxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d62dabb4275ffafc' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

我需要做些什么才能让MMC正确加载.Net 4.0运行时程序集?

对我来说,它告诉MMC使用v4框架,我有v4.0.30319

set COMPLUS_version=v4.0.30319
start SomeConsole.msc

检查变通方法: http//connect.microsoft.com/VisualStudio/feedback/details/474039/can-not-use-net-4-0-to-create-mmc-snapin

这是我的调试设置: 在此输入图像描述

我使用32位版本的控制台,还必须将以下内容添加到“c \\ Windows \\ SysWOW64 \\ mmc.exe.config”中:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version='v4.0' />
    </startup>
</configuration>

希望它能帮到你。 GL

请查看此页面上的评论( http://msdn.microsoft.com/en-us/library/ms692759%28VS.85%29.aspx )。 看起来托管MMC管理单元可以定位到大多数框架3.5。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM