こんにちは、C# で Dot Net アプリケーションを作成し、System.Management 名前空間を使用して DeviceID、Caption、ClassGUID などの USB デバイス情報を取得しました。ManagementObjectSearcher メソッドを使用して、Win32_DiskDrive から値を取得しています。Windowsで問題なく動作しています。Linuxマシンで実行したい。Mono を使用して、Linux マシンで Dot Net アプリケーションを実行できます。
http://mono-project.com/Main_PageMono を使用して Linux でアプリケーションの exe を実行すると、次のエラーが発生します。
Missing method .ctor in assembly /home/dvimay11/USBCamInfoNew/Debug/System.Management.dll, type System.Reflection.AssemblySignatureKeyAttribute
Can't find custom attr constructor image: /home/dvimay11/USBCamInfoNew/Debug/System.Management.dll mtoken: 0x0a000009
Unhandled Exception: System.TypeLoadException: Could not load type 'System.Reflection.AssemblySignatureKeyAttribute' from assembly 'System.Management'.
at USBCamInfo.USBInfo.GetUSBDevices () [0x00000] in <filename unknown>:0
at USBCamInfo.USBInfo.LoadUSBInfo () [0x00000] in <filename unknown>:0
at USBCamInfo.USBInfo..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) USBCamInfo.USBInfo:.ctor ()
at USBCamInfo.Program.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Reflection.AssemblySignatureKeyAttribute' from assembly 'System.Management'.
at USBCamInfo.USBInfo.GetUSBDevices () [0x00000] in <filename unknown>:0
at USBCamInfo.USBInfo.LoadUSBInfo () [0x00000] in <filename unknown>:0
at USBCamInfo.USBInfo..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) USBCamInfo.USBInfo:.ctor ()
at USBCamInfo.Program.Main () [0x00000] in <filename unknown>:0
誰でもこの問題を解決するのを手伝ってくれますか? System.Management 名前空間を使用して Linux マシンで Dot Net exe を実行し、USB デバイスの情報を取得する方法を知りたいと思いました。
ありがとう