Build and activation using the standalone System Manager

After opening a solution, the standalone System Manager can build the project for a target platform and transfer the configuration to the target system. Visual Studio is not required for this.

The build and activation are called via ITcSysManager16, which is obtained by casting the ITcSysManager object. BuildTargetPlatform compiles all projects in the solution for the specified platform. ActivateConfiguration transfers the completed configuration to the target system and corresponds to the Activate Configuration button in TwinCAT XAE. Both methods are synchronous.

Requirements

C# sample

The cast to ITcSysManager16 is needed for BuildTargetPlatform. The project should be saved after it has been built and activated.

// ITcSysManager16 required for BuildTargetPlatform
ITcSysManager16 sysMan16 = (ITcSysManager16)sysManager;

// Build for target platform
sysMan16.BuildTargetPlatform("TwinCAT RT (x64)");

// Activate configuration (transfer to target)
sysMan16.ActivateConfiguration();

// Save project
sysManager.SaveProject();
Build and activation using the standalone System Manager 1:

BuildTargetPlatform and ActivateConfiguration block synchronously until the respective step is completed.

PowerShell sample

In PowerShell, there is no need for an explicit cast to ITcSysManager16—its methods are directly available on the COM object via late binding (IDispatch).

$sysManager.BuildTargetPlatform("TwinCAT RT (x64)")
$sysManager.ActivateConfiguration()
$sysManager.SaveProject()