You could use FlubuCore. Flubu is A C# library that we wrote for building projects and executing deployment scripts using C# code.
Simple Example of how flubu is used in .net core
protected override void ConfigureTargets(ITaskContext context)
{
var compile = context
.CreateTarget("compile")
.SetDescription("Compiles the VS solution")
.AddCoreTask(x => x.ExecuteDotnetTask(StandardDotnetCommands.Restore).WithArguments("FlubuExample.sln"))
.AddCoreTask(x => x.Build("FlubuExample.sln"));
context
.CreateTarget("Package")
.CoreTaskExtensions()
.DotnetPublish("FlubuExample.sln");
var test = context.CreateTarget("test")
.AddCoreTaskAsync(x => x.Test().WorkingFolder("FlubuExample.Tests"))
.AddCoreTaskAsync(x => x.Test().WorkingFolder("FlubuExample.Tests2"));
context.CreateTarget("Rebuild")
.SetAsDefault()
.DependsOn(compile, test);
}
You can find more information about flubu and how to get started here:
choice-for-build-tool-msbuild-nant-or-something-else