Switch a Visual Studio Authoring Extension MP project between SCOM 2007 and SCOM 2012
Posted by Matthew on February 8, 2013
A couple of times now I’ve started a new MP project in Visual Studio using the Operations Manager Visual Studio Authoring Extensions, and about 45 minutes into my development realized I’ve created the wrong project type. There have also been a few occasions where requirements change and it makes more sense to change the project from a Core Monitoring (2007) management pack into a 2012 “add-on” pack.
It’s actually quite a simple change to make, providing you know which files to edit.
- Open the .mpproj file that represents your management pack project (NOT the solution file).
- Locate the MPFrameworkVersion element in the first PropertyGroup section, and modify it according to the version you want the project to build:
- For 2012, use <MpFrameworkVersion>v7.0</MpFrameworkVersion>
- For 2007, use <MpFrameworkVersion>v6.1</MpFrameworkVersion>
- If downgrading from 2012 to 2007, under the ItemGroup element containing the MP Reference elements, remove any references to MPs that don’t exist in 2007.
- Save the file.
Management Pack Fragments
Next, you’ll need to update the SchemaVersion attribute of the ManagementPackFragment element at the start of every .mpx file in your project. The good news is that you can just use Visual Studio’s find and replace option to replace this in all files in the solution simultaneously!
- Open the Project/solution in visual studio.
- Open one of the .mpx files, and hit Ctrl+H to open the “Find and Replace” window.
- To go from 2007 to 2012, in the “find what” box, enter <ManagementPackFragment SchemaVersion=”1.0″ and in “replace with” enter <ManagementPackFragment SchemaVersion=”2.0″
- Otherwise, do the reverse and in the “find what” box, enter <ManagementPackFragment SchemaVersion=”2.0″and in “replace with” enter <ManagementPackFragment SchemaVersion=”1.0″
- Make sure “Look in” is set to Current Project.
- You can now either click “Find Next” and “Replace” repeatedly if you aren’t comfortable letting VS just replace everything, or hit “Replace All“
Save all files in your project, and attempt a build. If you get any build errors relating to Management pack references or Schema Versions, just look for the reference/file that you missed and update the values.
Needless to say, you should always think carefully before you do this, and thoroughly test the MP to ensure that there aren’t any side effects from now using earlier/later versions of the default SCOM management packs. Going from 2007 -> 2012 is safer as 2012 is backwards compatible and will support your previous module configurations.
Hope that helps!