Based on Windows Input Simulator created my Michael Noonan. Originally a .net framework project, the source code has been updated to be used as a .net core project by Christiaan Wevers The Windows Input Simulator provides a simple .NET (C#) interface to simulate Keyboard or Mouse input using the Win32 SendInput method. All of the Interop is done for you and there's a simple programming model for sending multiple keystrokes.
$ dotnet add package InputSimulatorCoreNo README available.