I am using Spectre.Console extension for C# Console Application. And I wanted to use Live-Display module of Spectre.Console but I encoutered following problem:
'AnsiConsole' does not contain a definition for 'Live'
Here is my code, or better say, part of it which contains problem (... are parts which aren't required in sample, so during testing/debugging/modification remove them)
using System;
using Spectre.Console;
...
namespace ConsoleApp2
{
class Program
{
...
static void Main(...)
{
AnsiConsole.Live(Clock())
.Start(ctx =>
{
ctx.Refresh();
Thread.Sleep(1000);
});
...
}
...
public static void Clock()
{
Console.WriteLine(DateTime.Now.ToString());
}
...
}
...
}
Additional information
PM> Install-Package Spectre.Console
, not with dotnet add package Spectre.Console
as indicated in docs, but latter option was unavailable for some reason so I used first.Ok, so thanks to @JonSkeet's and @yaakov's comments, I tried installing latest pre-release version 0.39.1-preview-0.31 instead of latest stable version 0.39 and it worked.
Looks like problem was with versions.