[英]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.