Visual Studio Authoring Extensions (VSAE) – Part 1: Creating a new CI Class

I decided to do a VSAE series that explains how to use the Visual Studio Authoring Extensions to extend and customize Service Manager. This is indeed an excellent extension when Visual Studio is your Service Manager authoring tool! If it’s not, it’s definitely worth looking at it, and the System Center VSAE help you being successful.

Part 1 – VSAE Part 1: Creating a new CI Class (this post)
Part 2 – VSAE Part 2: Creating a Folder with a custom Image
Part 3 – VSAE Part 3: Creating Views by using Snippet Templates

 

Step 1 – Preparation

First you need to install Visual Studio 2010. After that, download and install the Visual Studio Authoring Extensions from here. Now start Visual Studio and create a new Project. Select “Service Manager 2012 Management Pack”, select name and location for the project and the solution.

image

When the project is created, it contains two references. These will be used in the “Manifest” area of the Management Pack to reference to other Management Packs.

image

Step 2 – Create a new Class

Now let’s add a class to our Management Pack project. You can do this by adding a new item. Select the Class template and define a meaningful name.

image

image

A new file is added to the project which holds the class definition. The cool thing when using VSAE is, that the MP elements are stored in different MP fragment files. Compared to one big XML file, this makes it more transparent and elements can be found and edited much faster. At the end when the MP is built, everything is glued together into a single XML-, MP- or MPB-file.

When you double click on the new item it opens and can be edited. The template contains a class example that helps creating your very own class. Also, IntelliSense is available to simplify the authoring process.

image

In this example I will create a new class called “Car” which will later be used to store information and relationships about car CIs in the CMDB. That means that some things need to be changed from the example class. Because I want to add another CI class, I need to derive from the Configuration Item class System.ConfigItem.  Because this class lives in another Management Pack, we need to reference to this class to get the base class. This is one of the default references that is already there. The alias is predefined and is called System.

image

Now back to the class where I change these things:

  • Change the base class to System!System.ConfigItem
  • Change the Accessibility to Public to make sure I can access the class from outside this Management Pack
  • Add some properties to the class, one as the key property which automatically increments
  • Add the needed display strings to the language pack area to translate the IDs to meaningful names

image

Step 3 – Deploy the Management Pack

Now as the class is ready it’s time to deploy the Management Pack to the Service Manager Management Group. This can be done directly from Visual Studio. Configure the properties of the project.

image

First define the Management Pack ID, Version and Friendly Name.

image

If needed, the Management Pack can be automatically sealed before it is deployed to the Management Group. This makes sense if the MP holds type definition. In this example, I choose to seal the MP, define the path to the strong name key file which is needed for the sealing process. You can get more information about that here. As a last step, I change the Configuration and Platform options as shown in the Screenshot.

image

Next I need to select the Management Server to connect to for the automatic deployment process. Just add a Management Server and specify the credentials.

image

The last configuration is about incrementing the MP version and the deployment process.

image

Now we are ready to go. First, save all the files of the project, then build the solution by hitting F6 or using “Build Solution” from the “Build” menu. This will create your Management Pack from the different fragments and store it in the bin\release folder within your project folder. There are several files created: a XML file (unsealed), if the option was selected a MP file (sealed) and a MP bundle file (MPB, to bundle additional resources with the Management Pack).

image

Now, to deploy the MP bundle to the Management Group you need to start the debugging process in Visual studio. If you specified to use different credentials to connect to the Management Group, you are prompted for those.

image

Step 4 – Verification

When the deployment process was successful, you should be able to see the new MP in the Management Pack list.

image

Because I only created a class in this example, we are not able to see anything for now. But you could now start creating views and use the created class to display and create car CIs. Something like this.

image

image

image

In the next part of this series I will demonstrate how to handle Folders, Views and Images in Visual Studio with VSAE. Make sure you don’t miss it!

Cheers
Marcel

This entry was posted in SCSM and tagged , , , , , , , . Bookmark the permalink.

15 Responses to Visual Studio Authoring Extensions (VSAE) – Part 1: Creating a new CI Class

  1. This is awesome. I look forward to the rest of the posts in this series. Being able to use Visual Studio for authoring will really enhance some of the authoring experience, I believe.

  2. Pingback: Include Files in Management Pack Bundle with Visual Studio Authoring Extensions (VSAE) « scsmlab

  3. René says:

    Awesome block post, thank you!

  4. Pingback: Visual Studio Authoring Extensions (VSAE) – Part 2: Creating a Folder with a custom Image | SCSMfaq.ch

  5. Johann says:

    Great post !
    However, I’m sad that we still cannot use VS2012…in 2013…
    Idea for another topic: Add the field “Car Owner” and pick up an AD User.

    • Hey

      Yeah, VS2012 would be cool! However, it will surely be supported one day🙂

      Cheers
      Marcel

    • I agree. VS2012 support really should be there. We played around with trying to make the extensions work with 2012, but ultimately there were a couple of issues that you just couldn’t work around.

  6. Pingback: Visual Studio Authoring Extensions (VSAE) – Part 3: Creating Views by using Snippet Templates | SCSMfaq.ch

  7. chris says:

    Hi, Very helpful post, thanks.
    I see, in your xml, you use a ‘DefaultValue’ attribute on the Property node of ClassType element. Is updated documentation for the System Center Service Manager Type schema available?
    That attribute is not shown in the Aug10, 2011, OM 2007 R2, documentation published here: http://msdn.microsoft.com/en-us/library/ee533714.aspx.
    It would be useful to know what other attributes are now available🙂
    Thanks, chris

  8. chris says:

    Thanks, found documentation that looks more upto date on travis’ public skydrive. — chris

  9. Jim says:

    This helps me get off the ground. What I’d really like to do is modify the default management packs for Incident or Change Management without affecting all new Incident or CM templates. I can modify the MP, but it keeps it’s own ID and I can’t import it into Service Manager. I guess I’d have to start with a blank project and somehow inject all the classes, forms, workflows?

  10. Rob says:

    Think the vsae will be supported in visual studio 2013? Since it is still not supported in VS2012….

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s