Skip to content

Custom dotnet CLI tools does not keep colors or empty line breaks #6836

@patriksvensson

Description

@patriksvensson

Steps to reproduce

Create a dotnet CLI tool that writes to the console using Console.ForegroundColor and/or Console.BackgroundColor.

using System;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Hello World!");
            Console.WriteLine();
            Console.ResetColor();
            Console.WriteLine("Goodbye!");
        }
    }
}

Now use this CLI tool with another .NET Core application.

Expected behavior

The Hello World line should be written in yellow.
Output should be formatted like this:

Hello World!

Goodbye!

Actual behavior

The output does not have any color.
Output is formatted like this:

Hello World!
Goodbye!

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
 Version:            1.0.0-preview2-003121
 Commit SHA-1 hash:  1e9d529bc5

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14915
 OS Platform: Windows
 RID:         win10-x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions