Page 1 of 1

CS2 server plugins with CounterStrikeSharp: what it is, the MetaMod step, and a first C# plugin

Posted: Sat Oct 24, 2026 10:38 am
by ice
Quick summary
CounterStrikeSharp is a framework that lets you write CS2 dedicated server plugins in C#. It sits on top of MetaMod:Source, so a fresh server needs both installed before a single plugin will load. This guide covers the prerequisites, the two install steps, the folder layout you should end up with, a minimal first plugin, and the failure modes that show up on a first install.

What CounterStrikeSharp is
The project describes itself as a way to write server plugins in C# for Counter-Strike 2, Source 2 and CS2. The documentation calls it a simpler way to write CS2 server plugins and points at the GitHub repository for downloads. Two details matter on a community server. MetaMod:Source is the layer that talks to the game server, and the getting started guide says both frameworks have to be installed. The project is licensed under GPL version 3 with a special exemption covering published plugins, which the repository README states and points at the LICENSE file for.

Prerequisites
The getting started guide lists two downloads:
  • Metamod: Source 2.X Dev Build, build 1467 or newer, with KHook support, from metamodsource.net.
  • CounterStrikeSharp With Runtime, from the project's GitHub releases page.
The with-runtime part matters. The troubleshooting section says that on a first install you must download the with-runtime build, because it includes a copy of the .NET runtime that the plugin needs.

Installing MetaMod
  • Extract MetaMod and copy the /addons/ directory to /game/csgo/.
  • Inside /game/csgo/, open gameinfo.gi.
  • Underneath the line Game_LowViolence csgo_lv, add a new line: Game csgo/addons/metamod.
  • Restart the game server.
Type meta list in the server console to confirm MetaMod loaded.

Installing CounterStrikeSharp
  • Extract CounterStrikeSharp and copy the /addons/ directory to /game/csgo/.
  • Restart the game server.
meta list should now report one plugin loaded:

Code: Select all

meta list
Listing 1 plugin:
  [01] CounterStrikeSharp (0.1.0) by Roflmuffin
The folder layout you should end up with

Code: Select all

addons
 counterstrikesharp
  api
  bin
  dotnet
  plugins
  gamedata
 metamod
  bin
  counterstrikesharp.vdf
  metaplugins.ini
  README.txt
 metamod.vdf
 metamod_x64.vdf
A first plugin
The docs example is a class that extends BasePlugin and overrides ModuleName, ModuleVersion, ModuleAuthor and ModuleDescription, along with Load and Unload:

Code: Select all

[MinimumApiVersion(80)]
public class HelloWorldPlugin : BasePlugin
{
    public override string ModuleName => "Example: Hello World";
    public override string ModuleVersion => "1.0.0";
    public override string ModuleAuthor => "CounterStrikeSharp & Contributors";
    public override string ModuleDescription => "A simple plugin that says hello world!";

    public override void Load(bool hotReload)
    {
        Logger.LogInformation("Hello World! We are loading!");
    }

    public override void Unload(bool hotReload)
    {
        Logger.LogInformation("Hello World! We are unloading!");
    }
}
The repository README shows the same shape with a game event handler and a console command attached to a class member:

Code: Select all

[GameEventHandler]
public HookResult OnPlayerConnect(EventPlayerConnect @event, GameEventInfo info)
{
    Logger.LogInformation("Player {Name} has connected!", @event.Userid.PlayerName);
    return HookResult.Continue;
}

[ConsoleCommand("css_issue_warning", "Issue warning to player")]
public void OnCommand(CCSPlayerController? player, CommandInfo command)
{
    Logger.LogWarning("Player should not be doing that");
}
Upgrading
Download the latest release and copy it over the same way as the first install. The guide says your configuration files will not be overwritten. Once CounterStrikeSharp is already installed you can use the non-runtime build, but then you have to keep your own .NET runtime up to date.

Troubleshooting
  • First install on a clean server: use the with-runtime build. The .NET runtime is required to run the plugin.
  • Linux servers may need libicu, icu-libs or libicu-dev from the package manager for .NET to run.
  • meta list returns Unknown Command: the folders were not copied correctly, or gameinfo.gi was not edited.
  • Windows servers need the Visual Studio Redistributables installed, or CounterStrikeSharp will not work.
FAQ
Does CounterStrikeSharp replace MetaMod?
No. The docs describe MetaMod:Source as the main way CounterStrikeSharp communicates with the game server, and the getting started guide installs MetaMod first.
Do I need the runtime build every time?
Only on a first install, according to the guide. Later upgrades can use the non-runtime build if your own .NET runtime is already current.
Where do plugins go?
The folder tree in the guide puts plugins under addons/counterstrikesharp/plugins, alongside api, bin, dotnet and gamedata.
Is it safe to run on a live server?
The guide does not cover that. It documents installation, upgrading and troubleshooting only, so test on a copy of your server first.
What language do I write plugins in?
C#. Both the repository description and the docs example are written in C#.

Sources
CounterStrikeSharp documentation
CounterStrikeSharp Getting Started guide
CounterStrikeSharp Hello World Plugin guide
CounterStrikeSharp repository