MySQL: Online
Load: Low
Sandbox: Ready

How to Fix "Missing Project Reference" Errors When Compiling a CounterStrikeSharp Plugin

Some plugins are split across two repositories: the plugin itself, and a separate "API" or "shared" project it depends on, usually linked as a git submodule. If you download the plugin as a plain .zip from GitHub, that submodule's content is not included, only a pointer to it. The result is a build that fails with dozens of confusing CS0246/CS0103 errors, "type or namespace not found", one for every class the missing project would have provided. The real cause is a single line, easy to miss.

1

Spot the real error

Scroll to the top of the failed build log, above the wall of CS0246 errors. Look for a line like this one, it's the actual cause, everything below it is a consequence:

warning MSB9008: The referenced project ../ggmcAPI/ggmcAPI.csproj does not exist.
2

Understand what it means

The plugin's .csproj file references another project by a relative path, in the example above, a folder called ggmcAPI, sitting one level above the plugin's own folder. That folder simply isn't in your uploaded archive.

3

Check if it's a git submodule

Open the plugin's page on GitHub and look for a folder shown with a small arrow icon and a short commit hash instead of a normal file listing, that's a submodule. GitHub's "Download ZIP" button never includes submodule content, only a pointer to which commit it should be. You'll need to open that submodule's own repository separately and download it on its own.

4

Get the folder depth right

This is the step people usually get wrong on the first try. The relative path in the .csproj (../ggmcAPI in our example) is resolved against the folder containing the .csproj file itself, not against the root of your .zip archive. If your plugin folder and the dependency folder aren't siblings, one level up resolves to the wrong place.

YourPlugin.zip
YourPlugin-1.0.0
YourPlugin.csproj
YourPlugin.cs
ggmcAPI
ggmcAPI.csproj
5

A common mistake to avoid

Placing the dependency folder inside the plugin's own folder looks reasonable, but it isn't what the relative path expects. This structure will fail the exact same way as having no folder at all:

YourPlugin.zip
YourPlugin-1.0.0
YourPlugin.csproj
ggmcAPI (wrong depth)
6

Recompile

Once both folders sit side by side at the correct depth, re-zip the archive and upload it again. If MSB9008 is gone from the log but you still see errors, those are now real compile errors worth looking into on their own.

Open the CS2Sharp Compiler

Was this tutorial useful?

0 users found this useful
Page generated in 0.013 seconds
CounterStrikeSharp Web Compiler V1.0 - Made with by RomaniaBarlap for the community.