beckhoff TE1000 TwinCAT 3 — 6.1.5 Reading the VS output and the error list

Samples | Visual Studio 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 6.1.5 Reading the VS output and the error list | Reading the VS output and the error list The contents of the build output window and the error list can be read programmatically using the DTE2 interface. This is useful for automated build reports. Requirements A DTE connection is active.

C# sample using EnvDTE; using EnvDTE80; DTE2 dte2 = (DTE2)dte; // Read build output window OutputWindow outputWindow = dte2.ToolWindows.OutputWindow; foreach (OutputWindowPane pane in outputWindow.OutputWindowPanes) { if (pane.Name == "Build") { TextDocument textDoc = pane.TextDocument; TextSelection sel = textDoc.Selection; sel.StartOfDocument(false); sel.EndOfDocument(true); string buildOutput = sel.Text; Console.WriteLine(buildOutput); break; } } TE1000 189 Version: 1.7.0