Skip to content

Microsoft.Management.Infrastructure NuGet package missing dependencies #4562

Closed

Description

I'm writing a ASP.NET Core web app that requires accessing CIM information/methods. Microsoft.Management.Infrastructure v4.0.0, available via NuGet, is not .NET Core compatible, so naturally I was curious how CIM works in PowerShell. I found that you are using a powershell-core https://powershell.myget.org/F/powershell-core/api/v3/index.json respository to host Microsoft.Management.Infrastructure v1.0.0-alpha06, so I added that to my project and everything seemed fine until I try to use any code from MMI.

I found a related issue #1204, but that issue was addressed for situations where MMI is used within the context of PowerShell. It looks like the solution was not applied directly to the MMI assembly itself.

I realize that the intention for the PowerShell Core version of MMI is to be used within the context of PowerShell, but it'd be much appreciated if the library was compatible with other use cases like ASP.NET Web Applications.

Steps to reproduce

I've posted a sample project so you can see how I am attempting to use the library.

Expected behavior

calc.exe runs on the remote host (localhost in this case). This is the result on Windows, but not Linux.

Actual behavior

The application crashes with the following error:

Unable to load DLL 'libmi.so': The specified module could not be found.

I found an issue (#2120) that talks about libmi.so being part of OMI, so I installed OMI and borrowed it. This fixed the first issue, but another issue came up with the following error:

Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "Microsoft.Management.Infrastructure.Strings.resources" was correctly embedded or linked into assembly "Microsoft.Management.Infrastructure" at compile time, or that all the satellite assemblies required are loadable and fully signed.

Environment data

The goal is to Dockerize this app, so the test system I am using is Docker's microsoft/aspnetcore Image (Debian Jessie).

uname -a
Linux ace-app 4.9.36-moby #1 SMP Wed Jul 12 15:29:07 UTC 2017 x86_64 GNU/Linux

Activity

  1. added
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on Aug 13, 2017
  2. iSazonov commented on Aug 13, 2017

    @iSazonov
    Collaborator

    Dongbo Wang (@daxian-dbw) Could you please comment?

  3. SteveL-MSFT commented on Aug 14, 2017

    @SteveL-MSFT
    Member

    The history of MMI is a bit complicated. MMI (aka WMIv2) was originally written in managed C++. Managed C++ is no longer supported. There was work started to have a pure C# implementation, but it was only sufficient for PowerShell purposes and not a replacement for the original. Since the industry has moved away from CIM towards JSON, it hasn't been a priority to complete the port.

  4. jaredcatkinson commented on Aug 14, 2017

    @jaredcatkinson
    Author

    Interesting. I was hoping there'd be a more straightforward solution, but I think I can probably just call Invoke-CimMethod from my assembly and get the result I'm looking for. I'd be interested in learning more about the JSON implementation you mentioned. Is it built on WMI/CIM? IMO, one of the most beneficial features of WMI/CIM is its ubiquity. I'd be worried if it was going to be killed off in future OS releases.

  5. SteveL-MSFT commented on Aug 14, 2017

    @SteveL-MSFT
    Member

    To clarify, WMI/CIM isn't being deprecated from Windows, however, no new development is happening in that area (it's basically considered complete).

    The JSON mention is about Redfish which we support via ODataUtils already.

    I think calling the CIM cmdlets via code is a fine solution.

  6. added this to the milestone on Aug 30, 2017
  7. added
    Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionality
    and removed
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on Aug 30, 2017
  8. SteveL-MSFT commented on Aug 30, 2017

    @SteveL-MSFT
    Member

    Reusing this issue to track completion of port of MMI to pure managed code.

  9. SteveL-MSFT commented on Jun 20, 2018

    @SteveL-MSFT
    Member

    No plans to port MMI to C#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalityResolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.WG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions