DenoHost.Core 2.9.1

dotnet add package DenoHost.Core --version 2.9.1
                    
NuGet\Install-Package DenoHost.Core -Version 2.9.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DenoHost.Core" Version="2.9.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DenoHost.Core" Version="2.9.1" />
                    
Directory.Packages.props
<PackageReference Include="DenoHost.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DenoHost.Core --version 2.9.1
                    
#r "nuget: DenoHost.Core, 2.9.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DenoHost.Core@2.9.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DenoHost.Core&version=2.9.1
                    
Install as a Cake Addin
#tool nuget:?package=DenoHost.Core&version=2.9.1
                    
Install as a Cake Tool

DenoHost

Build Coverage NuGet License: MIT


About

DenoHost allows you to seamlessly run Deno scripts or inline JavaScript/TypeScript code within your .NET applications.
It bundles platform-specific Deno executables as separate NuGet packages and provides a simple, consistent API for execution.


Features

  • Modular runtime packages (per RID)
  • Clean .NET API with async execution
  • Testable with xUnit
  • Packaged for NuGet (multi-target)
  • Linux, Windows, macOS support

NuGet Packages

dotnet add package DenoHost.Core
Package Description Platforms
DenoHost.Core Core execution logic (API) all
DenoHost.Runtime.win-x64 Bundled Deno for Windows win-x64
DenoHost.Runtime.win-arm64 Bundled Deno for Windows ARM win-arm64
DenoHost.Runtime.linux-x64 Deno for Linux linux-x64
DenoHost.Runtime.linux-arm64 Deno for ARM Linux linux-arm64
DenoHost.Runtime.osx-x64 Deno for macOS Intel osx-x64
DenoHost.Runtime.osx-arm64 Deno for macOS Apple Silicon osx-arm64

Typed Command API

Each Deno subcommand has a dedicated method with strongly-typed options:

using DenoHost.Core;
using DenoHost.Core.Commands;

// Run a script with permissions
await Deno.Run("app.ts", new RunOptions
{
    AllowRead = ["./data"],
    AllowNet  = [],          // empty = allow all
    Watch     = true,
});

// Evaluate TypeScript and capture JSON output
var result = await Deno.Eval<MyResult>("console.log(JSON.stringify({ ok: true }))");

// Run tests
await Deno.Test(options: new TestOptions { Filter = "my-suite" });

// Format and lint
await Deno.Fmt();
await Deno.Lint(options: new LintOptions { NoCache = true });

// Type-check
await Deno.Check(["src/main.ts"]);

// Compile to a standalone executable
await Deno.Compile("app.ts", new CompileOptions { Output = "dist/app" });

// Run a task from deno.json
await Deno.Task("build");

// Manage dependencies
await Deno.Add(["jsr:@std/fs"]);
await Deno.Remove(["jsr:@std/fs"]);

All methods accept an optional DenoExecuteBaseOptions to set the working directory or logger:

var baseOptions = new DenoExecuteBaseOptions { WorkingDirectory = "./scripts" };
await Deno.Run("app.ts", baseOptions: baseOptions);

Cancellation

Pass a CancellationToken as the last parameter to any command. Cancellation throws OperationCanceledException and terminates the underlying Deno process.

using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
await Deno.Test(cancellationToken: cts.Token);

Deno.Execute — Low-Level API

For cases not covered by the typed API, use Deno.Execute directly:

using DenoHost.Core;

var options = new DenoExecuteBaseOptions { WorkingDirectory = "./scripts" };
string[] args = ["run", "app.ts"];

await Deno.Execute(options, args);

Arguments and quoting

DenoHost passes arguments via ProcessStartInfo.ArgumentList. Pass each argument as its own string (avoid adding shell-style quotes inside argument strings).

await Deno.Execute("eval", ["console.log('hello world')"]);

DenoProcess — Long-Running Processes

DenoProcess manages a Deno process you control over time: start, send input, stop, restart, and subscribe to output events. It mirrors the typed command API with static factory methods for the three long-running commands:

using DenoHost.Core;
using DenoHost.Core.Commands;

// HTTP server (deno serve)
using var server = DenoProcess.Serve("server.ts", new ServeOptions
{
    AllowNet = [],
    AllowRead = ["./public"],
});

server.OutputDataReceived += (_, e) => Console.WriteLine(e.Data);
server.ErrorDataReceived  += (_, e) => Console.Error.WriteLine(e.Data);
server.ProcessExited      += (_, e) => Console.WriteLine($"Exited: {e.ExitCode}");

await server.StartAsync();
// … keep the server running …
await server.StopAsync();

// Script with watch mode (deno run)
using var watcher = DenoProcess.Run("worker.ts", new RunOptions
{
    AllowNet  = [],
    AllowRead = ["./"],
    Watch     = [],          // empty = watch all
});
await watcher.StartAsync();

// Deno task from deno.json (deno task)
using var task = DenoProcess.Task("dev", baseOptions: new DenoExecuteBaseOptions
{
    WorkingDirectory = "./app",
});
await task.StartAsync();
await task.WaitForExitAsync();

DenoProcess also supports interactive stdin and graceful restart:

using var denoProcess = DenoProcess.Run("worker.ts", new RunOptions { Watch = [] });
await denoProcess.StartAsync();

await denoProcess.SendInputAsync("hello");
await denoProcess.RestartAsync();
await denoProcess.StopAsync(timeout: TimeSpan.FromSeconds(5));

For cases that need full control over the argument list, the constructor accepts raw args:

using var process = new DenoProcess("run", ["--allow-read", "server.ts"],
    workingDirectory: "./scripts");
await process.StartAsync();

Requirements

  • .NET 9.0+
  • Deno version is bundled per RID via GitHub Releases
  • No need to install Deno globally

Security Integrity Checks

  • Runtime packages verify downloaded Deno archives with SHA-256 before extraction.
  • A SHA-256 checksum file is generated for the bundled executable and shipped with each runtime package.
  • Runtime packages can additionally ship deno.metadata.json and deno.metadata.sig.
  • DenoHost.Core requires signed metadata verification (signature + binary hash) before process start.
  • Production deployments can enable strict mode (DENOHOST_STRICT_MODE=true) to block emergency bypasses.

Maintainer-only details for signing keys, release gates, alpha verification, and emergency bypass are documented in Release Safety.

Feedback

If you're using DenoHost in a real project, I'd love to hear about it.

License

This project is licensed under the MIT License.

Security Policy

See SECURITY.md for how to report vulnerabilities.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.9.1 30 7/3/2026
2.9.1-alpha.1 41 7/3/2026
2.9.0 95 6/26/2026
2.9.0-alpha.1 57 6/26/2026
2.8.3 120 6/13/2026
2.8.3-alpha.15 62 6/13/2026
2.8.3-alpha.14 66 6/13/2026
2.8.1 118 5/27/2026
2.8.0 140 5/22/2026
2.7.14 433 4/29/2026
2.7.13 112 4/23/2026
2.7.12 111 4/10/2026
2.7.11 115 4/1/2026
2.7.10 110 4/1/2026
2.7.9 188 3/28/2026
Loading failed