COM automation of EXTRA! from dotnet core C# using VS Code

I am trying to convert a C# WPF application (that automates Extra! via the COM interface of Extra!) to a dotnet core application built with the Microsoft Visual Studio Code IDE. The application currently works fine when built as a WPF .net Framework application using Visual Studio Pro (or Visual Studio Community edition).

When using VS Code to compile the same code as a dotnet CORE program, I've run into the issue of how to properly add a reference to the EXTRA! object library so that the 'using EXTRA;' statement in my C# code can find the library. I'm new to the dotnet core world and have not yet found the right way to add the reference. From my searching, I suspect I may need to run the tlbimp utility to convert the extra.tlb file to an extra.dll and then (maybe) use a <Reference Include=...> block to my .csproj file. I also suspect I might need a using statement referring to an Interop assembly.  So far, my efforts to take those actions have not worked.

I am beginning to wonder if it is possible to build a dotnet core C# WPF application in VS Code running on Windows 10, that automates Extra! X-treme at the version level 9.3.2683.0 running on a Windows 10 OS.  I have not yet succeeded at figuring out how it might be possible. Any assistance to shorten my quest would be gratefully accepted.

The successful Visual Studio project that works (and needs conversion/porting to work as dotnet core in VS Code) is setup as follows:

It is a WPF App .net Framework project (not a .net CORE project)

The project References needed an 'add reference' to the extra.tlb from the EXTRA! program folder.

These lines were added to the .cs program file:

using EXTRA;

ExtraSystem XtraSystem;
ExtraSessions XtraSessions;
ExtraSession XtraSession;
ExtraScreen XtraScreen;

XtraSystem = (ExtraSystem)Activator.CreateInstance(Type.GetTypeFromProgID("EXTRA.System"));
XtraSessions = (ExtraSessions) XtraSystem.Sessions;
XtraSession = XtraSystem.Sessions("MAINFRAME DEMO SESSION");

XtraScreen = XtraSession.Screen;
string x = XtraScreen.GetString(2, 1, 60);

Thanks for any help you can give.

Parents Reply Children