Which DTE ProgID should be used for the respective TwinCAT/VS version?
The ProgID for New-Object -ComObject or GetActiveObject depends on whether TcXaeShell or Visual Studio is used as the host and which version is installed. A ProgID is a Programmatic Identifier and the human-readable name under which a COM server is registered in the registry and in the Running Object Table (ROT). Internally, it is mapped to a unique CLSID. If the wrong ProgID is used, the connection will fail because either no matching COM server is registered or a different IDE than the expected one is being addressed. Therefore, the installed host variant and its version should be clearly known before establishing a connection.
Overview of ProgIDs
ProgID | Host | Basic VS version |
|---|---|---|
| TwinCAT XAE Shell (based on VS 2022) | VS 2022 |
| TwinCAT XAE Shell (based on VS 2017) | VS 2017 |
| Visual Studio 2026 with the TwinCAT plugin | VS 2026 |
| Visual Studio 2022 with the TwinCAT plugin | VS 2022 |
| Visual Studio 2019 with the TwinCAT plugin | VS 2019 |
| Visual Studio 2017 with the TwinCAT plugin | VS 2017 |
Why are there different ProgIDs?
The version number corresponds to the Visual Studio major version number. VS 2017 uses 15, VS 2019 uses 16, VS 2022 uses 17, and VS 2026 uses 18. TcXaeShell is a VS Shell host and uses the same numbering as the VS release on which it is based. This makes it possible to deduce the underlying IDE generation directly from the ProgID, which is particularly helpful when writing portable scripts.
Which ProgID is registered depends on the software that is installed. If both Visual Studio and TcXaeShell are installed, both ProgIDs are available – for example, VisualStudio.DTE.17.0 and TcXaeShell.DTE.17.0. They point to different hosts. A common pitfall is using a ProgID with the wrong version number, such as TcXaeShell.DTE.15.0 on a system where only the VS 2022-based shell is installed. In such cases, GetActiveObject cannot find a matching entry, and the connection fails even though an IDE is running. A look at the registry under HKEY_CLASSES_ROOT shows which ProgIDs are registered on the computer.
Reading the available versions:
# read available Visual Studio versions
Get-ChildItem "Registry::HKEY_CLASSES_ROOT\VisualStudio.DTE*"
# read available TwinCAT Shell versions
Get-ChildItem "Registry::HKEY_CLASSES_ROOT\TcXaeShell.DTE*"Output
Hive: HKEY_CLASSES_ROOT
Name Property
---- --------
VisualStudio.DTE (default) : Microsoft Visual Studio DTE Object
VisualStudio.DTE.16.0 (default) : Microsoft Visual Studio DTE Object
VisualStudio.DTE.17.0 (default) : Microsoft Visual Studio DTE Object
VisualStudio.DTE.18.0 (default) : Microsoft Visual Studio DTE Object
Hive: HKEY_CLASSES_ROOT
Name Property
---- --------
TcXaeShell.DTE.15.0 (default) : TcXaeShell DTE Object
TcXaeShell.DTE.17.0 (default) : TcXaeShell DTE Object