create-cssharp-plugin offers a mighty fine project template to get you started quickly.
- Generates a
.slnfile with your.csprojalready referenced* - Bootstraps a
.csentry file withModule(.*)fields populated based on input - Initializes a git repository and stages the project for you
- Comes with a complementary
.gitignoreout of the box!
* dotnet CLI must be installed
- Unit test template
- Opinionated project structure (directories for commands, hooks, etc.)
- GitHub actions release workflow (build plugin and generate GH release with plugin artifacts attached)
NodeJS (v20 recommended)
You can get NodeJS by going to their website and selecting your OS, node version, and package manager.
https://nodejs.org/en/download
dotnet CLI [optional]
The dotnet CLI should come with .NET SDK.
Install .NET SDK
Linux
-
Windows
Learn more: https://learn.microsoft.com/en-us/dotnet/core/tools/
Run using your favourite package manager:
npm
Run on-demand via npm:
npx create-cssharp-plugin
OR install as a command globally:
npm install -g create-cssharp-plugin
create-cssharp-plugin
yarn
Run on-demand via yarn:
yarn exec create-cssharp-plugin
OR install as a command globally:
yarn global add create-cssharp-plugin
create-cssharp-plugin
pnpm
Run on-demand via pnpm:
pnpm dlx create-cssharp-plugin
OR install as a command globally:
pnpm add -g create-cssharp-plugin
create-cssharp-plugin
Create your CounterStrikeSharp plugin project using interactive step-by-step prompts in your terminal.
Run create-cssharp-plugin with no arguments to enter interactive mode and follow
the prompts.
ex. npx create-cssharp-plugin
Generate your CounterStrikeSharp plugin project directly from the command line.
Tip
View CLI options and usage help by passing -h or --help
Generate a project named "example"
create-cssharp-plugin example
Generate a project with a different plugin name(space).
create-cssharp-plugin -p differentName example
Generate a project with an author and description
create-cssharp-plugin -a JohnCSSharp -d "It's CSSharping time" example
Note
If you specify a project directory as the first positional argument when running
create-cssharp-plugin, all interactive prompts will be skipped and defaults will apply.
Enter interactive mode after passing arguments
Show prompts and skip those set via arguments:
create-cssharp-plugin -i example
Forcibly show all prompts with initial values populated from arguments:
create-cssharp-plugin -I example
More CLI option recipes
Say yes to all default build tasks (ex. git init) and ask remaining prompts interactively:
create-cssharp-plugin -yi example
create-cssharp-plugin -yip differentName example
Projects generated using create-cssharp-plugin have the following structure:
./projectName
├── projectName.sln
├── src
│ ├── pluginName.cs
│ └── pluginName.csproj
└── test
Note
create-cssharp-plugin will create a project
directory relative to your current working directory.
- Clone this repository
git clone https://github.com/uFloppyDisk/create-cssharp-plugin.git
cd create-cssharp-plugin- Install dependancies
npm install- Open another shell and watch for changes
npm run dev- Run the CLI
npx .When running the CLI this way, all plugin projects will be placed in the .playground
directory to avoid mixing with the rest of your filesystem and this repo's files.