none
Cannot add Microsoft.ManagementConsole.dll to GAC RRS feed

  • Question

  •  

    When working with Microsoft.ManagementConsole Snap-In ver 3.0 samples provided by MSDN, I was getting ReflectionTypeLoadException.  When I tried to add Microsoft.ManagementConsole.dll 6.0.6001.17011 to GAC I found that it was released as delay-signed or test-signed assembly.  I used SN.exe to find that out.  Can anyone please let me know am I using the wrong version of MMC SDK or How do I fix the dll.  Any help is appreciated.

     

    Exception ---

     

    Installing assembly 'C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.dll'.
    Affected parameters are:
       logtoconsole =
       assemblypath = C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.dll
       showcallstack =
       logfile = C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.InstallLog
    An exception occurred while trying to find the installers in the C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.dll assembly.
    System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
       at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
       at System.Reflection.Module.GetTypes()
       at System.Configuration.Install.AssemblyInstaller.GetInstallerTypes(Assembly assem)
       at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
    Aborting installation for C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.dll.
    Rolling back assembly 'C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.dll'.
    Affected parameters are:
       logtoconsole =
       assemblypath = C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.dll
       showcallstack =
       logfile = C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.InstallLog
    An exception occurred while trying to find the installers in the C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.dll assembly.
    System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
       at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
       at System.Reflection.Module.GetTypes()
       at System.Configuration.Install.AssemblyInstaller.GetInstallerTypes(Assembly assem)
       at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
    Aborting installation for C:\Documents and Settings\owner\My Documents\Visual Studio 2005\Projects\SimpleSnapIn\SimpleSnapIn\bin\Debug\SimpleSnapIn.dll.

    Thursday, May 8, 2008 4:02 AM

Answers

  •  

    Thanks for prompt reply.  I found the problem "Microsoft.ManagementConsole.dll Version 6.0.6001.17011" is delay-signed or test-signed assembly.  I found that when I tried to load the SimpleSnapIn.dll using Assembly.GetTypes  I had all my dll in the same directory (SimpleSnapIn.dll, Microsoft.ManagementConsole.dll and mmcfxcommon.dll") and it threw the following exception.

     

    Loader ExceptionCould not load file or assembly 'Microsoft.ManagementConsole, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)

     

    I verified the same using SN.Exe -v option.  I copied Microsoft.ManagementConsole.dll (Version 5.2.3790.3959) from Windows 2003 Server  and all the samples work like a charm.  It would be a great help for other developers if Microsoft releases a hotfix with the signed version of dll.

     

    Thanks and I appreciate your quick response.

    Sandeep.

    Friday, May 9, 2008 10:21 PM

All replies

  • Hi,

       Thanks for your post.
      

       As I understand, you are working with the Microsoft Management Console Snap-in sample provided by MSDN, and get ReflectionTypeLoadException when trying to install the snap-in.

       The ReflectionTypeLoadException is thrown by the Module.GetTypes method if any of the classes in a module cannot be loaded. In your scenario, it's probably caused by missing of some assemblies, and as far as I know for installing MMC snap-ins, if
    Microsoft.ManagementConsole dll is not in the GAC, both the Microsoft.ManagementConsole.dll and the SimpleSnapInSample.dll must be in the same directory, so I would suggest you check this first. 

      If the Microsoft.ManagementConsole dll is in the GAC, or both Microsoft.ManagementConsole.dll and the SimpleSnapInSample.dll are in the same directory, then the second suggestion I would like to give is to check whether there's an assembly called "mmcfxcommon.dll" in the Debug directory or not, if not, you can go to the following path to get that assembly and copy it to the Debug directory,

    C:\Program Files\Reference Assemblies\Microsoft\mmc\v3.0

    If this not helps my third suggestion for you is to try the suggestion given by Karin Meier in this thread
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2621568&SiteID=1



    Windows Forms Forum Support Team
    Windows Forms General FAQ
    DataBinding and Data Controls FAQ


    Best Regards
    Zhi-xin Ye

    Friday, May 9, 2008 8:29 AM
  •  

    Thanks for prompt reply.  I found the problem "Microsoft.ManagementConsole.dll Version 6.0.6001.17011" is delay-signed or test-signed assembly.  I found that when I tried to load the SimpleSnapIn.dll using Assembly.GetTypes  I had all my dll in the same directory (SimpleSnapIn.dll, Microsoft.ManagementConsole.dll and mmcfxcommon.dll") and it threw the following exception.

     

    Loader ExceptionCould not load file or assembly 'Microsoft.ManagementConsole, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)

     

    I verified the same using SN.Exe -v option.  I copied Microsoft.ManagementConsole.dll (Version 5.2.3790.3959) from Windows 2003 Server  and all the samples work like a charm.  It would be a great help for other developers if Microsoft releases a hotfix with the signed version of dll.

     

    Thanks and I appreciate your quick response.

    Sandeep.

    Friday, May 9, 2008 10:21 PM
  • Hi Sandeep,

    I see the same issue as you - I'm developing a C# Snap-In using VS 2008.

    Changing both "mmcfxcommon.dll" & "microsoft.managementconsole.dll" from v.6.0.6001.17011 to v.5.2.3790.3959 fixes the registration issue.

    OS: Windows Server 2003 Ent. Ed. SP2.
    Installed Visual Studios: VS 2005 & VS 2008.

    James.
    Thursday, July 3, 2008 2:48 PM
  • I am getting the same problem.  So what is the resolution/recomendation?  Is it  changing the version on the local copied mmc's to v.5.2.3790.3959?
    hank voight
    Wednesday, October 15, 2008 6:09 PM
  • In doing more digging I have found that Microsoft ships the following 3 versions of the Microsoft.ManagementConsole.dll

    5.2.3790.2612
    5.2.3790.4136
    6.0.6001.17011

    How can I figure out which version to use, during the install?  What should I tell my customers to use?


    hank voight
    Wednesday, October 15, 2008 7:52 PM