Configuring Visual Studio to use SCCM Assemblies

Configuring Visual Studio to use SCCM Assemblies

Overview

In order to write SCCM SDK code it is necessary to use some of the .NET assemblies that are supplied with the SCCM console. The assemblies are located in C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin. For basic operations the following assemblies are usually required:

  • Microsoft.ConfigurationManagement.ManagementProvider.dll
  • AdminUI.WqlQueryEngine.dll

Other assemblies are required for more complicated SCCM functions, for example those that work with the Application model and Rights-based Access Control (RBAC) categories:

  • Microsoft.ConfigurationManager.CommonBase.dll
  • Microsoft.ConfigurationManagement.ZipArchive.dll
  • DcmObjectModel.dll
  • AdminUI.DcmObjectWrapper.dll
  • AdminUI.RbacCategory.dll
  • Microsoft.ConfigurationManagement.ZipArchive.dll
  • AdminUI.AppManFoundation.dll
  • Microsoft.ConfigurationManagement.ApplicationManagement.*

Configuring Visual Studio to use SCCM Assemblies

The most basic way write programs that use the SCCM assemblies is:

  • Copy the required DLLs into your Visual Studio project folder
  • Add the DLLs as References
  • Set the references to be copied to your output folder on compile (the SCCM are in the same folder as your resulting executable)
  • Distribute your program and the reference assemblies

SCCM Assembly Redistribution

Bundling your program executable with the SCCM assemblies is a perfectly acceptable solution when you are writing a company internal-use application. However, if you intend to publish the application on the internet then a major problem is that it is not permitted to redistribute the SCCM assemblies. When distributing your program outside of your company you must only include your program executable and remove the SCCM SDK assemblies and then:

  • Ask the end user to find an SCCM console and manually copy the the required DLL files
  • Configure an installer or script that will look for a locally installed SCCM console and automatically copy the DLLs files

Neither of these methods are very user friendly. My preferred solution is to require that the end-user has a locally installed copy of the SCCM console and then configure the executable to automatically load the required assemblies on demand. For details of this method see: Using AssemblyResolve to Load SCCM SDK Assemblies On Demand.