Framework-Agnostic Install
This page shows how to install Workflow Engine in a console application, worker service, or any non-ASP.NET Core host. For ASP.NET Core projects, use the Web API install instead - it provides HTTP endpoints, built-in security, and multitenancy.
The example below uses a console application, but the same steps apply to any .NET host.
Prerequisites:
- .NET 10 SDK
- A running database (SQL Server, PostgreSQL, MySQL, Oracle, or MongoDB) - SQLite uses a local file and does not require a running server
Step 1: Create a new console project
Start by creating a console application with the .NET SDK:
dotnet new console -n WorkflowConsole --framework net10.0cd WorkflowConsoleStep 2: Install packages and write Program.cs
Choose your database provider. Each tab shows the NuGet packages to install and the corresponding Program.cs code.
dotnet add package WorkflowEngine.NETCore-Coredotnet add package WorkflowEngine.NETCore-ProviderForSQLiteCopy and paste the following code to replace the contents of Program.cs:
using System.Xml.Linq;using OptimaJet.Workflow.Core.Builder;using OptimaJet.Workflow.Core.Parser;using OptimaJet.Workflow.Core.Runtime;using OptimaJet.Workflow.Migrator;using OptimaJet.Workflow.SQLite;var connectionString = "Data Source=workflow.db";var provider = new SqliteProvider(connectionString);var workflowBuilder = new WorkflowBuilder<XElement>( provider, new XmlWorkflowParser(), provider).WithDefaultCache();var runtime = new WorkflowRuntime() .WithBuilder(workflowBuilder) .WithPersistenceProvider(provider) .RunMigrations() .Start();Console.WriteLine("Workflow Runtime started. Press any key to stop.");Console.ReadKey();await runtime.ShutdownAsync();Console.WriteLine("Workflow Runtime stopped.");dotnet add package WorkflowEngine.NETCore-Coredotnet add package WorkflowEngine.NETCore-ProviderForMSSQLCopy and paste the following code to replace the contents of Program.cs:
using System.Xml.Linq;using OptimaJet.Workflow.Core.Builder;using OptimaJet.Workflow.Core.Parser;using OptimaJet.Workflow.Core.Runtime;using OptimaJet.Workflow.Migrator;using OptimaJet.Workflow.DbPersistence;var connectionString = "PUT YOUR CONNECTION STRING HERE";var provider = new MSSQLProvider(connectionString);var workflowBuilder = new WorkflowBuilder<XElement>( provider, new XmlWorkflowParser(), provider).WithDefaultCache();var runtime = new WorkflowRuntime() .WithBuilder(workflowBuilder) .WithPersistenceProvider(provider) .RunMigrations() .Start();Console.WriteLine("Workflow Runtime started. Press any key to stop.");Console.ReadKey();await runtime.ShutdownAsync();Console.WriteLine("Workflow Runtime stopped.");dotnet add package WorkflowEngine.NETCore-Coredotnet add package WorkflowEngine.NETCore-ProviderForMySQLCopy and paste the following code to replace the contents of Program.cs:
using System.Xml.Linq;using OptimaJet.Workflow.Core.Builder;using OptimaJet.Workflow.Core.Parser;using OptimaJet.Workflow.Core.Runtime;using OptimaJet.Workflow.Migrator;using OptimaJet.Workflow.MySQL;var connectionString = "PUT YOUR CONNECTION STRING HERE";var provider = new MySQLProvider(connectionString);var workflowBuilder = new WorkflowBuilder<XElement>( provider, new XmlWorkflowParser(), provider).WithDefaultCache();var runtime = new WorkflowRuntime() .WithBuilder(workflowBuilder) .WithPersistenceProvider(provider) .RunMigrations() .Start();Console.WriteLine("Workflow Runtime started. Press any key to stop.");Console.ReadKey();await runtime.ShutdownAsync();Console.WriteLine("Workflow Runtime stopped.");dotnet add package WorkflowEngine.NETCore-Coredotnet add package WorkflowEngine.NETCore-ProviderForPostgreSQLCopy and paste the following code to replace the contents of Program.cs:
using System.Xml.Linq;using OptimaJet.Workflow.Core.Builder;using OptimaJet.Workflow.Core.Parser;using OptimaJet.Workflow.Core.Runtime;using OptimaJet.Workflow.Migrator;using OptimaJet.Workflow.PostgreSQL;var connectionString = "PUT YOUR CONNECTION STRING HERE";var provider = new PostgreSQLProvider(connectionString);var workflowBuilder = new WorkflowBuilder<XElement>( provider, new XmlWorkflowParser(), provider).WithDefaultCache();var runtime = new WorkflowRuntime() .WithBuilder(workflowBuilder) .WithPersistenceProvider(provider) .RunMigrations() .Start();Console.WriteLine("Workflow Runtime started. Press any key to stop.");Console.ReadKey();await runtime.ShutdownAsync();Console.WriteLine("Workflow Runtime stopped.");dotnet add package WorkflowEngine.NETCore-Coredotnet add package WorkflowEngine.NETCore-ProviderForOracleCopy and paste the following code to replace the contents of Program.cs:
using System.Xml.Linq;using OptimaJet.Workflow.Core.Builder;using OptimaJet.Workflow.Core.Parser;using OptimaJet.Workflow.Core.Runtime;using OptimaJet.Workflow.Migrator;using OptimaJet.Workflow.Oracle;var connectionString = "PUT YOUR CONNECTION STRING HERE";var provider = new OracleProvider(connectionString);var workflowBuilder = new WorkflowBuilder<XElement>( provider, new XmlWorkflowParser(), provider).WithDefaultCache();var runtime = new WorkflowRuntime() .WithBuilder(workflowBuilder) .WithPersistenceProvider(provider) .RunMigrations() .Start();Console.WriteLine("Workflow Runtime started. Press any key to stop.");Console.ReadKey();await runtime.ShutdownAsync();Console.WriteLine("Workflow Runtime stopped.");dotnet add package WorkflowEngine.NETCore-Coredotnet add package WorkflowEngine.NETCore-ProviderForMongoDBCopy and paste the following code to replace the contents of Program.cs:
using System.Xml.Linq;using OptimaJet.Workflow.Core.Builder;using OptimaJet.Workflow.Core.Parser;using OptimaJet.Workflow.Core.Runtime;using OptimaJet.Workflow.MongoDB;var connectionString = "PUT YOUR CONNECTION STRING HERE";var provider = new MongoDBProvider(connectionString);var workflowBuilder = new WorkflowBuilder<XElement>( provider, new XmlWorkflowParser(), provider).WithDefaultCache();var runtime = new WorkflowRuntime() .WithBuilder(workflowBuilder) .WithPersistenceProvider(provider) .Start();Console.WriteLine("Workflow Runtime started. Press any key to stop.");Console.ReadKey();await runtime.ShutdownAsync();Console.WriteLine("Workflow Runtime stopped.");The connectionString value needs to point to your database. For SQLite, the default Data Source=workflow.db creates a local file - update the path to match your project. For other providers, replace PUT YOUR CONNECTION STRING HERE with your actual connection string.
Step 4: Run and verify
Build and run the project to check that the runtime starts correctly:
dotnet runIf the runtime starts without exceptions, Workflow Engine creates all required tables in your database automatically.
Next steps
Create Your First Workflow
Save a scheme and create a process instance through the Web API.
Integrate the Designer
Run the Designer standalone or embed it in your application.
Frequently asked questions
Which NuGet packages do I need for a non-ASP.NET Core project?
Install WorkflowEngine.NETCore-Core and the persistence provider package matching your database - for example, WorkflowEngine.NETCore-ProviderForSQLite for SQLite or WorkflowEngine.NETCore-ProviderForMSSQL for SQL Server. The provider transitively pulls in WorkflowEngine.NETCore-Migrator (schema setup).
How do I initialize WorkflowRuntime without ASP.NET Core?
Create a persistence provider instance with your connection string, pass it to WorkflowBuilder, call RunMigrations() to create the required database tables, then call Start(). No DI container or web host is needed.
Does Workflow Engine create its own database tables automatically?
For SQL providers, calling RunMigrations() during initialization creates all required tables in the target database if they do not exist, and applies any pending schema updates. You do not need to run SQL scripts manually.
For MongoDB, RunMigrations() is not applicable - collections and indexes are created automatically by the provider at runtime, no explicit migration call is needed.
Can I use Workflow Engine without a database at runtime?
No. Workflow Engine persists process state, scheme definitions, timers, and history to a database. A persistence provider is required.