views:

218

answers:

1

Hi, folks

Recently,I need run my winforms App on mono for windows platform,But i am using WMI to get MAC address and CPU ID in my original code,switch to Mono for Windows,it does not working. I found that "System.Management.dll" APIs is not implemented in Mono.

How can i do?How to get CPU ID,MAC Address, Hard Disk Serial Number,and Motherboard Serial Number with out WMI?

A: 

I don't expect Mono will ever implement code that can communicate with WMI since that is a platform specific API. If you are targeting your software to run on Windows, why not just use the Microsoft .Net runtime? Is there a specific reason you must use Mono?

The simplest answer is just use the Microsoft runtime if you can since you are writing non-platform-independent code.

If you really must use the mono runtime and can not use the Microsoft Implementation of System.Management.dll I think you might be able to get what you want by using Interop Services. Mono can interact with native libraries http://www.mono-project.com/Interop_with_Native_Libraries. Also WMI is available by COM interfaces which Mono can also do so you may need to go down that route. http://www.mono-project.com/COM

Neither Interop nor COM is going to be as easy as just using System.Management.dll, but it is an alternative.

William Leader