Opening an existing C++ project

An existing C++ project can be integrated into a TwinCAT solution via the Automation Interface without having to use the IDE manually. To do this, CreateChild() is called on the TIXC node, and the full file path to the project file is passed as the fourth parameter. Native project files with the .vcxproj extension and compressed TwinCAT project archives with the .tszip extension are supported. After successful integration, the method returns the new ITcSmTreeItem. You can use this object to perform additional actions on the project, such as creating modules or reading properties.

C# sample

ITcSmTreeItem cpp = systemManager.LookupTreeItem("TIXC");

// Open an existing C++ project by its full file path (.vcxproj or .tszip)
ITcSmTreeItem newProject = cpp.CreateChild("", 1, "", pathToProjectOrTczipFile);

PowerShell sample

$cpp = $systemManager.LookupTreeItem("TIXC")

# Open an existing C++ project by its full file path (.vcxproj or .tszip)
$newProject = $cpp.CreateChild("", 1, "", $pathToProjectOrTczipFile)
Opening an existing C++ project 1:

C++ projects cannot be renamed. The name passed as the first parameter is ignored when the file is opened. The project always appears in the solution under the name saved in the project file. If you want a project to appear in the solution under a different name, you must rename the project file itself before adding it to the solution.