Before you begin: Before creating a new class you need to decide on a class ID and a display name. You should also think about if your class should have any properties.
For more information, consult the MP Content document, section Class naming.
If the project is not open in Visual Studio, open it.
Right-click the project name in the solution explorer and choose
Add\New folder. The name of the folder should be same as the description part of the Class ID. So if the full Class ID is
MyCompany.TestMP.3.0.ApplicationServerComputerRole.Class, the folder would be named
Right-click the new folder and choose
In the list, select
Empty Management Pack Fragment.
Enter a name for the fragment. This should be the same as the folder you created before. Click
Add. The fragment is created and opened.
Right-click between the
<ManagementPackFragment> tags and select
MPDevToolkit\Classes\Computer Role. Depending on how many properties the class should have, choose the corresponding Computer Role snippet. The code is inserted.
Enter the MPID and press
Enter the class name. This is the description part of the class ID and should be the same as the fragement name.
If you have choosen a snippet for a class with one or more properties, do the following step for each property. Otherwise, skip this step and continue with Class Display Name.
Enter the name of the property and press
tab. Choose a type for the property. If it is a string, just press
tab. Otherwise, press
Backspace and then press
Ctrl-Space. A list of possible types are shown. Pick one and press
Repeat this for each property.
Enter the Class display name you decided on earlier. Press
tab. Enter a class description. Press
If you have choosen a snippet for a class with one or more properties, do the following step for each property. Otherwise, skip this and continue to the last step.
The property name is automatically entered as display name. But enter a short description of the property and press
tab. Repeat this for each property.
enter to stop editing the snippet. The class has now been created.
Save the file/project.