.NET core utilities
dotnet new console --use-program-main -n test
cd test
dotnet add package netcore-util
dotnet run-
copy usings.util.cs global usings to the source folder
using SearchAThing.Util;using static SearchAThing.Util.Toolkit;dotnet test- to debug from vscode just run debug test from code lens balloon
namespace SearchAThing.Util.Examples;
class Program
{
static void Main(string[] args)
{
Task.Run(async () =>
{
var q = await ExecBashRedirect("i=0; while (($i < 5)); do echo $i; let i=$i+1; done",
CancellationToken.None,
sudo: false,
verbose: false);
if (q.ExitCode == 0)
{
System.Console.WriteLine($"output[{q.Output}]");
}
// RESULT:
//
// output[0
// 1
// 2
// 3
// 4
// ]
}).Wait();
}
}mkdir netcore-util
cd netcore-util
dotnet new sln
mkdir -p examples src/util
cd src/util
dotnet new classlib -n netcore-util
# add packages ( https://nuget.org )
cd ..
dotnet new xunit -n test
cd test
dotnet add reference ../util/netcore-util.csproj
cd ..
dotnet sln add src/util src/test examples/example01
dotnet build
dotnet test