Workers 0.2.0

dotnet add package Workers --version 0.2.0
                    
NuGet\Install-Package Workers -Version 0.2.0
                    
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="Workers" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Workers" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Workers" />
                    
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 Workers --version 0.2.0
                    
#r "nuget: Workers, 0.2.0"
                    
#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 Workers@0.2.0
                    
#: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=Workers&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Workers&version=0.2.0
                    
Install as a Cake Tool

Workers

Write Cloudflare Workers in C# via WebAssembly.

using Workers;

public static class Worker
{
    [FetchEvent]
    public static Task<Response> FetchAsync(
        Request request,
        Env environment,
        Context context)
    {
        return Task.FromResult(
            Response.Text("Hello from C# on Cloudflare Workers."));
    }
}

Usage

Workers are plain static methods marked with event attributes:

[FetchEvent]
public static Task<Response> FetchAsync(
    Request request,
    Env environment,
    Context context)

The package includes Worker-native APIs for requests, responses, routing, bindings, Durable Objects, queues, R2, D1, KV, caches, sockets, email, and other Workers platform features.

Publishing

Publish with the browser-wasm runtime:

dotnet publish -c Release -r browser-wasm

Workers defaults to invariant globalization for smaller bundles. If your Worker needs culture-specific formatting or comparisons, set WorkersInvariantGlobalization to false.

Publishing writes a dist/ folder with the Worker module, runtime adapter, and _framework files for deployment with Wrangler.

Keep deployment settings like routes, bindings, migrations, vars, and observability in your Wrangler config.

For HTTP-only Workers that do not call platform bindings or helper APIs, set WorkersIncludePlatformApis to false to emit a smaller adapter.

Examples

Small standalone examples are in examples/. Each one has its own project file and wrangler.toml, so you can view or copy the shape you need.

Example Shows
BasicResponse Plain text response
JsonApi JSON response and request path
Redirects Redirects from query parameters
CorsHeaders CORS and response headers
ProxyFetch Fetching another origin
CacheApi Workers Cache API
KvBinding KV namespace binding
R2Binding R2 bucket binding
QueueProducer Sending queue messages
QueueConsumer Consuming queue messages
ScheduledTask Cron/scheduled events
HelloWorld Minimal router usage
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
0.2.0 82 7/1/2026
0.1.0 69 7/1/2026