Compile-Time Compatibility Overview

Updated: January 31, 2012

Applies To: System Center 2012 - Operations Manager

This document describes the compile-time compatibility support in the System Center 2012 – Operations Manager software development kit (SDK) by guiding you through the process of updating your old Operations Manager 2007 R2 client code to support the new Operations Manager binaries.

This document also contains descriptions of the key areas in the Operations Manager SDK that have changed.

Setting Up Your Visual Studio Environment

  1. Ensure that you have the Microsoft .NET Framework 4 installed on your system.

  2. Start Microsoft Visual Studio 2008 or Visual Studio 2010.

  3. Open the project that contains your old Operations Manager 2007 R2 client code.

  4. Remove all references to the following Operations Manager 2007 R2 binaries:

    1. Microsoft.EnterpriseManagement.OperationsManager.Common.dll

    2. Microsoft.EnterpriseManagement.OperationsManager.dll

    3. Microsoft.EnterpriseManagement.UI.Extensibility.dll

  5. In the project’s properties dialog box, change the target framework for your project to .NET Framework 4.

  6. Add references to the following Operations Manager binaries:

    1. Microsoft.EnterpriseManagement.Core.dll

    2. Microsoft.EnterpriseManagement.OperationsManager.dll

    3. Microsoft.EnterpriseManagement.Runtime.dll

    The Operations Manager software development kit (SDK) binaries are located on all management servers in the %ProgramFiles%\System Center 2012\Operations Manager\Server\SDK Binaries\ folder.

  7. Compile your project. Check the warning list regarding obsolete APIs. Fix the obsolete APIs as directed.

Although the warning messages tell you how to change your old code, in many cases a little more information is helpful. The following section contains information about some of the class library changes in Operations Manager. You can use this information to find the new APIs.

Class Library Implementation Changes

The following are the key areas in the Operations Manager SDK that have changed.

ManagementGroup Class
In the Operations Manager 2007 R2 SDK, the ManagementGroup class had more than 5,000 members. To simplify the use of this class and make it easier to find members, its members have been split into functional interfaces and corresponding class implementations. These class implementations are accessible by their corresponding properties on the ManagementGroup class. Almost all of the Get- methods that are defined in this class have been marked as obsolete.

Management Pack Classes
In the Operations Manager 2007 R2 SDK, all management pack type classes had names that contained a Monitoring- prefix. For example, the class that represented a rule type that was defined in a management pack was called a MonitoringRule. In the System Center 2012 – Operations Manager SDK, all classes that represent or relate to the type definition instance in a management pack now have a ManagementPack- prefix. See the following table for some examples.


Operations Manager 2007 R2 SDK version System Center 2012 – Operations Manager SDK version
  • MonitoringClass

  • MonitoringClassProperty

  • MonitoringRuleCriteria

  • MonitoringRule

  • MonitoringViewType

  • MonitoringFolder

  • MonitoringFolderCriteria

  • ManagementPackClass

  • ManagementPackClassProperty

  • ManagementPackRuleCriteria

  • ManagementPackRule

  • ManagementPackViewType

  • ManagementPackFolder

  • ManagementPackFolderCriteria

In addition to these name changes, all of these new ManagementPack- classes have been moved into new namespaces. Most of these classes can now be found in the System Center 2012 core library’s Microsoft.EnterpriseManagement.Configuration namespace. Other classes, such as and , have been moved into the System Center 2012 core library’s interface. You can get an interface reference from the ManagementGroup’s property.
Accessing Monitoring Objects: IObjectReader
In the Operations Manager 2007 R2 SDK, you used the GetMonitoringObjects method from the management group object. This method is now obsolete. In the System Center 2012 – Operations Manager SDK, you must get an interface reference from the ManagementGroup’s property. When you get the interface, you can then call the method, which returns an IEnumeration object:

private static MonitoringObject GetComputerMonitoringObject(string computerFQDN)
  ManagementPackClass windowsComputerClass = mg.EntityTypes.GetClass(SystemMonitoringClass.WindowsComputer); 
  MonitoringObjectGenericCriteria monitoringObjectCriteria = new MonitoringObjectGenericCriteria(string.Format("PrincipalName = '{0}'", computerFQDN));

  IObjectReader<MonitoringObject> reader =  mg.EntityObjects.GetObjectReader<MonitoringObject>(monitoringObjectCriteria, windowsComputerClass, ObjectQueryOptions.Default);
  List<MonitoringObject> monitoringObjects = new List<MonitoringObject>();
  monitoringObjects.AddRange (reader);
  return (monitoringObjects[0]);

Getting and Setting Monitoring Object Properties
In the Operations Manager 2007 R2 SDK, you were able to get or set a monitoring or partial monitoring object property by calling the GetMonitoringPropertyValue method on the object. In the System Center 2012 – Operations Manager SDK, the monitoring or partial monitoring objects are defined with a dictionary indexer that makes it possible for you to get or set any one property by passing in that property definition object:

static void GetSetPropertyValues(MonitoringObject mObject)
  foreach(ManagementPackProperty property in mObject.GetProperties())
	 mObject[property] = “Some Value”;
	 Console.WriteLine("	" + property.Name + " = " + mObject[property].Value.ToString());
Getting and Setting Management Pack Class Properties
Getting and setting management pack class properties is similar to getting and setting monitoring object properties. (See the previous section.) You can access the indexer on the management pack class object to set or get the property value:

static void GetSetPropertyValues(ManagementPackClass mClass)
  mClass[“PropertyName2”].Value =”1”;
  mClass[“PropertyName2”].Value =”2”;

In the Operations Manager 2007 R2 SDK, most of the collection Get- methods returned a ReadOnlyCollection<T> collection object. In the System Center 2012 – Operations Manager SDK, all of the new Get- methods now return an IList<T> collection object:

ManagementGroup mg = new ManagementGroup("localhost");
IList<ManagementPackMonitor> monitors = mg.Monitoring.GetMonitors();
IList<ManagementPackRule> rules = mg.Monitoring.GetRules();
Criteria Objects
In the Operations Manager 2007 R2 SDK, you had the option of passing in a criteria string as a single parameter. In the System Center 2012 – Operations Manager SDK, none of the Get- methods support a string parameter. Instead, you must always use the corresponding criteria object as a parameter:

ManagementGroup mg = new ManagementGroup(“localhost”);
string criteria = string.Format("DisplayName = '{0}'", displayName);
ManagementPackCriteria mpCriteria = new ManagementPackCriteria(criteria);
ManagementPack mp = mg.ManagementPacks.GetManagementPacks(mpCriteria)[0];

See Also