CSharpTask 2.0.0
dotnet add package CSharpTask --version 2.0.0
NuGet\Install-Package CSharpTask -Version 2.0.0
<PackageReference Include="CSharpTask" Version="2.0.0" />
paket add CSharpTask --version 2.0.0
#r "nuget: CSharpTask, 2.0.0"
// Install CSharpTask as a Cake Addin #addin nuget:?package=CSharpTask&version=2.0.0 // Install CSharpTask as a Cake Tool #tool nuget:?package=CSharpTask&version=2.0.0
CSharpTask
Microframework with provides tasks functionality into C# console application similar to rake in Ruby
Package
Package link: https://www.nuget.org/packages/CSharpTask/1.0.0
How to implement new task
Check CSharpTask.ExampleApp/Tasks/Dummy
task example
- Implement 3 classes inside
{RootNamespace}.{TaskName}
namespace:{TaskName}Task
- with task implementation{TaskName}Options
- for task configuration{TaskName}Startup
- to register the task with its dependencies
- Provide
TaskDescriptionAttribute
with values for{TaskName}Task
class
How to run task
Check CSharpTask.ExampleApp/Program.cs
for the example setup.
- Register the task in your application using the
TaskExtensions.UseStartup
with task name provided from application arguments - Validate task name from arguments with
TaskExtension.ValidateRequestedTask
method. - Run application with task name as an argument to execute task
- Run application without a ny arguments to display all implemented tasks
Example output from the CSharpTask.ExampleApp
dotnet run --project CSharpTask.ExampleApp/CSharpTask.ExampleApp.csproj
Dummy: this is an example of task description
dotnet run --project CSharpTask.ExampleApp/CSharpTask.ExampleApp.csproj -- Dummy
DummyTask.ExecuteAsync Test Setting
Entity Framework Note!
EF uses own head-of-control while run command line tools (eg. ef migrate
), it injects own entry point changing result of Assembly.GetEntryAssembly()
method as side effect. It will lead to InvalidOperationException
with message: Cannot find <task name> in <EF assembly>
.
Use IHostBuilder UseStartup(this IHostBuilder hostBuilder, string taskName, Assembly? asm)
with typeof(Program).Assembly
provided into Assembly? asm
argument to mitigate this error.
if (!string.IsNullOrWhiteSpace(taskName))
{
hostBuilder.UseStartup(taskName, typeof(Program).Assembly);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
-
net7.0
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
-
net8.0
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Add support for .net8; Add possibility to override task's assembly