Terminal: Cannot find info on hosting terminal in another app.

Created on 13 Feb 2020  Â·  13Comments  Â·  Source: microsoft/terminal

We need documentation on hosting the console. Project templates would be very helpful.

Area-TerminalControl Issue-Docs Product-Meta

Most helpful comment

This is literally line 4, as a Priority 0 item:

Terminal's core will be hostable as a UWP (and perhaps WPF) Control so that apps can host/embed a high quality Terminal. This will satisfy a long-standing ask from many customers and partners for a hostable/embeddable Terminal Control.

source


From: Dustin L. Howett (MSFT) notifications@github.com
Sent: Thursday, February 13, 2020 4:11 PM
To: microsoft/terminal terminal@noreply.github.com
Cc: The Sharp Ninja ninja@thesharp.ninja; Author author@noreply.github.com
Subject: Re: [microsoft/terminal] Cannot find info on hosting terminal in another app. (#4572)

We haven’t promised documentation on that, because hosting an unconstrained application from a UWP context is currently impossible. This is why we didn’t build the terminal as a UWP. That’s just not something the platform supports.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/microsoft/terminal/issues/4572?email_source=notifications&email_token=AD3GCLE4BVNKY2PNGGCQBGTRCXARRA5CNFSM4KU25ZHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELWZXCY#issuecomment-585997195, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD3GCLFVVFSAQIK2JFIT23TRCXARRANCNFSM4KU25ZHA.

All 13 comments

This is very well-documented on our docs.microsoft.com section

There's also samples in this repository.

There are no samples or document for hosting in a UWP process, which has been promised for a long time. Please reopen.

We haven’t promised documentation on that, because hosting an unconstrained application from a UWP context is currently impossible. This is why we didn’t build the terminal as a UWP. That’s just not something the platform supports.

This is literally line 4, as a Priority 0 item:

Terminal's core will be hostable as a UWP (and perhaps WPF) Control so that apps can host/embed a high quality Terminal. This will satisfy a long-standing ask from many customers and partners for a hostable/embeddable Terminal Control.

source


From: Dustin L. Howett (MSFT) notifications@github.com
Sent: Thursday, February 13, 2020 4:11 PM
To: microsoft/terminal terminal@noreply.github.com
Cc: The Sharp Ninja ninja@thesharp.ninja; Author author@noreply.github.com
Subject: Re: [microsoft/terminal] Cannot find info on hosting terminal in another app. (#4572)

We haven’t promised documentation on that, because hosting an unconstrained application from a UWP context is currently impossible. This is why we didn’t build the terminal as a UWP. That’s just not something the platform supports.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/microsoft/terminal/issues/4572?email_source=notifications&email_token=AD3GCLE4BVNKY2PNGGCQBGTRCXARRA5CNFSM4KU25ZHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELWZXCY#issuecomment-585997195, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD3GCLFVVFSAQIK2JFIT23TRCXARRANCNFSM4KU25ZHA.

Okay you're not wrong about that. That doc is maybe a little out of date, but I guess we did mention that publicly.

The way the terminal's architecture is designed, it's certainly _possible_ to re-use the terminal control in other UWP projects. However, I think we've let the priority of that particular feature slip a bit as we approach 1.0. AS it currently stands, I don't think that we'll have the cycles to be able to _officially_ support a nuget package or something for the terminal control in the 1.0 timeframe. I think it was more important for us to _prepare_ for allowing arbitrary apps to host the control, and that we've most certainly done.

Thant being said, it'd definitely be possible to _unofficially_ use the TerminalControl.dll and TerminalControl.winmd that's built from this project in other projects. I'm not saying you _should_ do this. I'm saying you _could_.

@DHowett-MSFT is alluding to the fact that launching other processes from a UWP context is fraught with peril. Those perils is why we've chosen the Win32+Xaml Hosting model for the Terminal. That being said, you could totally add a terminal to a pure UWP application. Just be aware that it's a _here be dragons_ path.

We probably should add documentation on this, but I'm going to toss it on the backlog, since I don't think we'll want to author documentation at this time while things are still changing pretty rapidly.

Ah, sorry about that!

Totally cool!

I am very happy to _guinea pig this_ as I'm working on a project that literally is providing a programmer's "toolbox" that having an embedded terminal is a foundational requirement, and I started this project after months ago reading that quote and anxiously awaiting the release of the hostable console. I understand not wanting to post any formal docs yet, but if you could at least give me a rough set of steps to get a terminal hosted in a C# UWP app then I'd be greatly appreciative.

@sharpninja If you're willing to take instructions with _no warranty whatsoever_ and do something that might simply break for no reason because we're not ready to ship it yet, read on...


And on and on

If you _build Terminal_, you'll get a bunch of interesting things in ./x64/Debug:

  • TerminalControl.dll and TerminalControl.winmd: These implement the terminal control; the winmd is how you'll import references to another project. This is _easier_ with C#, actually, but I don't know how it's going to feel about activating classes from these DLLs.
  • resources.pri: Localizable resources from the entire terminal app and all of microsoft.ui.xaml (sorry: we can't split it finer than this right now; you might be able to grab a pri from x64/Debug/TerminalControl?)
  • TerminalSettings.dll and TerminalSettings.winmd: A single-class library that lets you construct an object that can be used to pass settings to a terminal.
  • TerminalConnection.dll and TerminalConnection.winmd: Contains the ITerminalConnection interface you'll need to conform to _and_ a couple other classes. If you don't need the conpty, azure or telnet connections you should be able to get by with only the winmd? If you copy the dll, make sure to copy cpprest and telnetpp DLLs as well.

Know that you'll be going significantly off-road here.

Anyway, once you grab those things and integrate them into your own package, you should be able to host a Microsoft.Terminal.TerminalControl.TermControl (yes, that is a heck of a name) in your Xaml tree. It can't be constructed without an IControlSettings (TerminalSettings winmd) and an ITerminalConnection (TerminalConnection winmd).

There might be one or two .xbf files you need as well; if you see it failing to load SearchBoxControl, you'll want to make sure you copy that over too.

It's really not in a good place right now!

Thank you so much! I know what I’m doing this weekend.

If you want to go significantly the _other_ way on this, the WpfTerminalControl project will produce a nuget package with far fewer dependencies that'll work with _WPF_ Xaml (yeah!) down to Windows 7ish. I know that's really outside the scope of UWP :wink:

If you want to go significantly the _other_ way on this, the WpfTerminalControl project will produce a nuget package with far fewer dependencies that'll work with _WPF_ Xaml [...]

Where can I find more information about WpfTerminalControl and how to use it in my WPF application?

Sorry -- it's undocumented for a reason. It's very much an act of trailblazing to get it going.

Was this page helpful?
0 / 5 - 0 ratings