CSharpSyntaxValidator 2.0.0

dotnet tool install --global CSharpSyntaxValidator --version 2.0.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 CSharpSyntaxValidator --version 2.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=CSharpSyntaxValidator&version=2.0.0
                    
nuke :add-package CSharpSyntaxValidator --version 2.0.0
                    

C# Syntax Validator

CSharpSyntaxValidator is a .NET CLI tool that validates a C# source for syntax errors and sets its exit code to zero (0) if the C# source is valid and one (1) if invalid.

It is not a linter for C#.

Installation

You will need .NET SDK 10 or later installed.

Install CSharpSyntaxValidator as follows:

dotnet tool install --global CSharpSyntaxValidator

Usage

Simply invoke supplying C# source on standard input:

csval < Program.cs && echo OK

If the source is valid, the above will print OK on your terminal.

Alternatively, supply the file name directly:

csval Program.cs && echo OK

For more help on usage, run with the -h option:

csval -h

Development Usage

CSharpSyntaxValidator is a file-based application, so you can also run it using dotnet as follows:

dotnet CSharpSyntaxValidator.cs < Program.cs && echo OK

On Unix-like systems, ./CSharpSyntaxValidator.cs can also be invoked directly as an executable:

./CSharpSyntaxValidator.cs < Program.cs && echo OK

For help, run:

dotnet CSharpSyntaxValidator.cs -- -h

Building

Since CSharpSyntaxValidator is a file-based application, an explicit build step is not necessary for usage, but the .NET SDK is the minimum requirement. However, you can package it as a .NET CLI tool using:

dotnet pack CSharpSyntaxValidator.cs

Yu can also publish it as a self-contained application that does not require a .NET runtime installation using:

dotnet publish CSharpSyntaxValidator.cs
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.

This package has no dependencies.

Version Downloads Last Updated
2.0.0 94 1/4/2026
1.4.0 3,614 8/14/2021
1.3.0 1,849 9/27/2019
1.2.0 1,088 5/22/2019
1.1.0 850 4/4/2019
1.0.1 865 3/24/2019
1.0.0 792 3/21/2019