Enable .NET 4 in Orchestrator Integration Toolkit
WARNING: please note that this is a just workaround to use .NET 4 but it is NOT supported by the product group. I have been using it without any issues, but it does not mean this approach is well tested.
Currently the Orchestrator Integration Toolkit (OIT) in Orchestrator 2012 RTM only supports .NET 3.5 (which is CLR2), this means only assemblies in CLR2 will be packaged into OIP file and get deployed and be runnable in the system. If you create a Class Library project in Visual Studio using .NET 4 for developing an integration pack, it will not work. This is because CLR2 does not support CLR4 assemblies. However, CLR4 supports In-Process Side-by-Side, so if the policy module process loads CLR4 first then both CLR4 and CLR2 assemblies will work.
Take a deeper look at the architecture of the server extension, In fact policy module is written in native code and it only understands COM interface. During installation, a managed class in Microsoft.SystemCenter.Orchestrator.Integration.Framework.dll is registered as a 32-bit COM server using regasm.exe. That is the entry point from native code to managed code. By changing the runtime version of this COM server, we can specify which .NET to load.
Before doing the following changes, make sure .NET 4 has been installed. Otherwise nothing will work.
So the first step is to change the runtime version of aforementioned COM server in the registry. Run regedit.exe, search “Microsoft.SystemCenter.Orchestrator.Integration.Framework” under HKCR\Wow6432Node\CLSID or go directly to HKCR\Wow6432Node\CLSID\{A2FE38AE-8F0D-4bad-AC0D-C1DC1EFD392A}\InprocServer32, change “RuntimeVersion” from “v2.0.50727” to “v4.0.30319”. Also change the same key at HKCR\Wow6432Node\CLSID\{A2FE38AE-8F0D-4bad-AC0D-C1DC1EFD392A}\InprocServer32\7.0.0.0.
With this change, integration packs written in .NET4 will be loaded. We also want to package OIP so IPWizard.exe has to be loaded with CLR4 otherwise it cannot load .NET 4 assemblies and cannot perform the reflection. This can be done by creating create IPWizard.exe.config at "C:\Program Files (x86)\Microsoft System Center 2012\Orchestrator\Integration Toolkit\Bin" with the following contents:
<configuration>
<startup>
<supportedRuntime version="v4.0.30319" />
</startup>
</configuration>
Now everything is done. The system is ready to handle both existing integration packs in .NET 3.5 and new ones in .NET 4. I will be releasing one to try it out. Stay tuned.
Comments
- Anonymous
May 25, 2012
Very cool Yao thank you for sharing