dotnet-ngql 2.1.0

dotnet tool install --global dotnet-ngql --version 2.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local dotnet-ngql --version 2.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-ngql&version=2.1.0
                    
nuke :add-package dotnet-ngql --version 2.1.0
                    

dotnet-ngql

Command-line tool for NGql — compiles a C# QueryBuilder snippet against NGql.Core and prints the rendered GraphQL.

Install

dotnet tool install -g dotnet-ngql --prerelease

The --prerelease flag is required while NuGet only has preview versions. Once a stable 2.x.0 ships, the flag becomes optional.

Update

dotnet tool update -g dotnet-ngql --prerelease

The tool's version tracks NGql.Core in lockstep — installing a specific NGql version is --version 2.1.0-preview.X --prerelease.

If ngql reports "command not found"

The .NET SDK installs global tools to ~/.dotnet/tools/, but doesn't always add that path to new shells. Either persist it in your shell rc:

echo 'export PATH="$PATH:$HOME/.dotnet/tools"' >> ~/.zshrc   # or ~/.bashrc

…or set it for the current shell:

export PATH="$PATH:$HOME/.dotnet/tools"

Use

Render from a file:

ngql my-snippet.cs

Render from stdin:

cat my-snippet.cs | ngql
# or
echo 'QueryBuilder.CreateDefaultBuilder("Hello").AddField("world.name")' | ngql

A snippet is an expression-bodied C# script. The final expression must yield the builder whose ToString() will be printed. The tool automatically imports:

using System;
using System.Collections.Generic;
using System.Linq;
using NGql.Core;
using NGql.Core.Builders;

so a complete snippet can be as small as:

QueryBuilder.CreateDefaultBuilder("Hello")
    .AddField("world.name")

The output is plain GraphQL on stdout — composable with shell redirects:

ngql my-snippet.cs > out.graphql

Exit codes

Code Meaning
0 rendered successfully
1 snippet failed to compile or threw at runtime (error on stderr)
64 invalid usage
66 input file not found

When to use this

  • Hand verification that a QueryBuilder snippet renders the GraphQL you expect.
  • Companion tool for the NGql Claude Code skill, which generates NGql code from natural language or pasted GraphQL.
  • Quick rendering inside CI scripts or git hooks (e.g. snapshotting expected query text).

License

MIT, same as NGql itself.

Product Compatible and additional computed target framework versions.
.NET 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.  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 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.

This package has no dependencies.

Version Downloads Last Updated
2.1.0 101 5/4/2026
2.1.0-preview.47 43 5/4/2026
2.1.0-preview.37 56 5/2/2026
2.1.0-preview.36 47 5/2/2026
2.0.1-preview.21 49 5/2/2026
2.0.1-preview.19 56 5/2/2026