Opening existing projects from a TwinCAT Target

This documentation article describes how to open existing TwinCAT projects from a connected TwinCAT Target. The Target needs to be available, which means that ADS routes have to be present in order to be able to retrieve the project from the Target.

The following code snippet demonstrates how to retrieve the TwinCAT project from a connected Target Runtime.

Code snippet (C#):

dte.ExecuteCommand("File.OpenProjectFromTarget", "CX-123456 C:\\ProjectDir ProjectName");

Code snippet (Powershell):

$dte.ExecuteCommand("File.OpenProjectFromTarget", "CX-123456 C:\\ProjectDir ProjectName");

The method ExecuteCommand() from the Visual Studio API allows to trigger the TwinCAT command (File.OpenProjectFromTarget) to open the project from a connected TwinCAT Target. The three parameters are to be included in the second parameter of the ExecuteCommand() method. These three parameters are: Route name to Target, local project directory (where the project files should be stored), local project name. All three parameters are to be separated with a space from each other.