CounterStrikeSharp Compiler Online

Compile CounterStrikeSharp plugins online for free. Single .cs file or a full .csproj - cloud build, download a ZIP for your CS2 server.

Checking…

1 Build mode

2 Configuration

XcstrikeDemoPlugin.cs
—
Output
Ready

                        
                    

Frequently asked questions

What is the CounterStrikeSharp compiler and what does it build?

CounterStrikeSharp (often shortened to CS#) is the C# plugin API for Counter-Strike 2 dedicated servers. This page runs "dotnet publish" in the cloud so you can build a plugin without installing the .NET SDK, NuGet, or a local CounterStrikeSharp workspace. Single mode compiles one .cs file. Project mode accepts a ZIP with a .csproj and multiple sources. The output is a ZIP you extract into addons/counterstrikesharp/plugins. It does not compile AMXX .sma or SourceMod .sp files.

Do I need the .NET SDK or Visual Studio on my PC?

No. XCSTRIKE restores NuGet packages and publishes the plugin on the server. You need a browser and your source. On the CS2 machine you still need CounterStrikeSharp itself installed (Metamod + the CounterStrikeSharp runtime). After a successful build, extract the ZIP into the plugins folder and change the map so the plugin loads. If the API version in the dropdown is newer than the CounterStrikeSharp build on the game server, the plugin may fail to load - match the API your server already uses.

How should I choose the CounterStrikeSharp API version?

Pick the CounterStrikeSharp.API version that matches the runtime in addons/counterstrikesharp on your CS2 server (the same number you would put in a local .csproj PackageReference). Newer API packages can require a newer shared runtime. If a build succeeds here but the dedicated server refuses the DLL, lower the API version to the one shipped with your CounterStrikeSharp install, or update CounterStrikeSharp on the game server first.

When do I use Single mode versus Project mode?

Single mode is for one plugin class in a single .cs file. Project mode is for solutions with several files, your own .csproj, or extra assets. Upload a ZIP that contains the .csproj at a reasonable depth; huge archives are rejected (size and file-count limits apply). Project builds count as two toward the hourly rate limit (20 builds per hour). Downloads expire after one hour, so save the ZIP locally.

Where do I install the ZIP on a CS2 server?

Extract it under addons/counterstrikesharp/plugins so the plugin folder contains the DLL and any configs the build produced. Restart the map or the server. The compiler is free. If you are writing GoldSrc AMXX or CS:GO SourceMod plugins, use those compilers instead - CounterStrikeSharp is CS2 only.

Common CounterStrikeSharp build errors and how to fix them

CounterStrikeSharp plugins are normal .NET projects, so build errors use the standard C# and NuGet codes. These are the ones that come up most when building CS2 plugins.

Error CS0246

CS0246: The type or namespace name "BasePlugin" could not be found

A using directive or a package reference is missing. Add using CounterStrikeSharp.API.Core; (and the other CounterStrikeSharp namespaces you use), and if the type comes from another NuGet package, add a PackageReference for it to the .csproj.

Error CS1061

CS1061: "CCSPlayerController" does not contain a definition for "Health"

The member does not exist on that type (health, for example, lives on the player pawn, not on the controller), or it is not in the CounterStrikeSharp version you are building against. The API changes between releases, so code copied from an older plugin may use renamed members. Match the CounterStrikeSharp.API package version to the one installed on your server.

Error CS0103

CS0103: The name "playerCount" does not exist in the current context

A variable or method is used outside its scope, or misspelled. C# is case-sensitive: OnPlayerConnect and onPlayerConnect are different names.

Error NU1101

NU1101: Unable to find package "CSSharp.API"

The package name in the .csproj is wrong or the version does not exist on NuGet. Check the exact package ID and version on nuget.org.

Warning CS8618

CS8618: Non-nullable property must contain a non-null value

A warning from nullable reference types, not an error. Initialise the property, mark it nullable with ?, or disable <Nullable> in the .csproj. The plugin still builds.

Server

Plugin builds but does not load on the server

The .dll must sit in addons/counterstrikesharp/plugins/<PluginName>/<PluginName>.dll, with the folder and file names matching. Also check that the plugin class inherits BasePlugin and that the server runs a CounterStrikeSharp version compatible with the one you built against.