开发者

How can one have a dedicated console window per AppDomain in a console .NET application?

开发者 https://www.devze.com 2022-12-14 09:07 出处:网络
My console .NET application has several app domains. My wish is simple - console window per app domain.

My console .NET application has several app domains. My wish is simple - console window per app domain.

Motivation:

The application is actually an MbUnit test assembly and the various app domains are the server hosts all packed in one process, though in different app domains to decrease execution time. Each server outputs to conso开发者_JAVA百科le, so when the console is shared with MbUnit test assembly one gets a salad. I wish to grant dedicated console window for each server app domain.

We use log4net for logging, so we can log to files and view files later, but at this stage it is much more convenient to log to console.

Thanks.

EDIT

I have solved my particular problem using TelnetAppender. I derived from it and from within ActivateOptions open a telnet client. To the user it looks like there are several console log windows.


You can only have (technically) a single console per Application (not AppDomain).

That being said, it is technically possible to simulate this behavior. It requires spawning a separate child application, and using Pipes to push the console output for each separate "console" to its own child application. Here is a CodeProject article demonstrating this approach (in C++).

0

精彩评论

暂无评论...
验证码 换一张
取 消