简体   繁体   中英

Cannot find WMI classes in Visual Studio Server Explorer

I am attempting to use WMI in Visual Studio 2012. So far, I have been able to add management classes to Server Explorer, and then generate the appropriate C# code. The generated code isn't perfect - in fact it needs substantial work in some cases - but it is good enough to get me started quickly.

However, there are some classes I'm not seeing in the Add Classes dialog. Find class containing: does not find them either. But I do see the associated MOF file on the system, and in this case, they are Hyper-V classes (eg Msvm_SnapshotOfVirtualSystem ) for functions that work on the system today, so presumably the classes are registered or the management tools would not work on the system.

What could keep WMI classes from showing in the Add Classes dialog?

Here's a picture of what you are doing .

You have discovered that the Server Explorer does not explicitly show "association" classes. Instead, associations appear as links between classes in the tree view.

What do I mean?

There is no field in Msvm_ComputerSystem to tell you which Msvm_VirtualSystemSettingData objects it corresponds to. That information is stored in a Msvm_SnapshotOfVirtualSystem object. The Server Explorer shows the link between the two but not the class of object that stores the link.

Eg in this picture, we see two Msvm_ComputerSystem objects. The first has been snapshotted, and it has a Msvm_VirtualSystemSettingData in its tree view. The object that stores the relationship between Msvm_ComputerSystem and Msvm_VirtualSystemSettingData does not appear in the tree.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM