Configuration | Basics int IOleMessageFilter.MessagePending(System.IntPtr hTaskCallee, int dwTickCount, int dwPendingType) { return 2; } [DllImport("Ole32.dll")] private static extern int CoRegisterMessageFilter(IOleMessageFilter newFilter, out IOleMessageFilter oldFilter); } [ComImport(), Guid("00000016-0000-0000-C000-000000000046"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] interface IOleMessageFilter { [PreserveSig] int HandleInComingCall(int dwCallType, IntPtr hTaskCaller, int dwTickCount, IntPtr lpInterfaceInfo); [PreserveSig] int RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType); [PreserveSig] int MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType); } } '@ Add-Type -TypeDefinition $source } 4.2.6 Handling different Visual Studio versions | Handling different Visual Studio versions This article explains how to use the TwinCAT Automation Interface with different versions of Visual Studio, e.g.
Visual Studio 2017 and 2019, if you have both or more versions installed at the same time. Visual Studio program ID Due to the installation of TwinCAT 3 Engineering in Visual Studio, you must create an instance of Visual Studio (DTE object) in order to access the Automation Interface. To create this instance, the ProgID is required, which specifies which version of Visual Studio is to be used. Different versions of Visual Studio or TcXaeShell can be installed on a system, which can be distinguished by the ProgID. The ProgID is located in the Windows registry under HKEY_CLASSES_ROOT and has the following format: VisualStudio.DTE.X.Y.
The following table shows the ProgIDs of the currently supported Visual Studio versions: Specifying the Visual Studio version in the Automation Interface code To specify the Visual Studio version in the Automation Interface code, you must use the ProgID as a parameter in the GetTypeDromProgID() method when creating the DTE object. Code snippet (C#): Type t = System.Type.GetTypeFromProgID("VisualStudio.DTE.15.0"); EnvDTE.DTE dte = (EnvDTE.DTE) System.Activator.CreateInstance(t); Code snippet (PowerShell): $dte = new-object -com VisualStudio.DTE.15.0 TE1000 32 Version:
1.7.0 Version ProgID Visual Studio 2017 VisualStudio.DTE.15.0 Visual Studio 2019 VisualStudio.DTE.16.0 Visual Studio 2022 VisualStudio.DTE.17.0 Visual Studio 2026 VisualStudio.DTE.18.0 TwinCAT XAE Shell TcXaeShell.DTE.15.0 TwinCAT XAE Shell 64-bit TcXaeShell.DTE.17.0