Setting up the standalone System Manager
The standalone System Manager allows you to automate TwinCAT projects without Visual Studio. Instead of being instantiated via the DTE, it is instantiated directly via COM using the ProgID TcSysManagerRM. The entry-point object ITcSysManagerRM then creates an ITcSysManager object via CreateSysManager15. This approach is suitable for scripts, services, and CI/CD pipelines that are designed to process a TwinCAT project without a complete XAE installation.
Requirements
- TwinCAT XAE is installed.
- The call is made in an STA thread.
- The registry keys for COM access are configured for service operation under the
LocalSystemaccount.
C# sample
The ITcSysManagerRM object is created from the ProgID using Activator.CreateInstance. CreateSysManager15 returns the ITcSysManager object used to open and edit the configuration.
using TCatSysManagerLib;
// Instantiate standalone SysMan
var sysManagerRM = Activator.CreateInstance(
Type.GetTypeFromProgID("TcSysManagerRM", throwOnError: true)!)
as ITcSysManagerRM;
// Create ITcSysManager object
ITcSysManager sysManager = sysManagerRM.CreateSysManager15();
// Open solution and work
sysManager.OpenConfiguration(@"C:\Projects\MyProject\MyProject.tsproj");
PowerShell sample
In PowerShell, the object is created using New-Object -ComObject with the same ProgID.
$rm = new-object -com TcSysManagerRM
$sysManager = $rm.CreateSysManager15()
$sysManager.OpenConfiguration("C:\Projects\MyProject\MyProject.tsproj")