Cross-platform .NET Module/Plugin platform for Garry's Mod powered by .NET.
Gmod.NET is Garry's Mod Module/Plugin loader for C# and other .NET languages which runs across all platforms (Windows, Linux, macOS). Gmod.NET allows you to develop cross-platform Garry's Mod extensions without need to close or reload your game or server.
Gmod.NET allows you to write Garry's Mod modules in C# or any other CIL-compiled language as .NET class libraries.
For more information on modules and API check out our documentation.
Only x86_64
version of Garry's Mod is currently supported.
Check out our docs and join our discord server.
To build GmodDotNet you need to have following software installed and registered with your PATH environment variable:
Latest version of git
Latest version of CMake
Latest version of dotnet SDK
(On Windows) Latest version of Visual Studio 2019 with C++ workload
(On macOS) Latest version of Xcode
(On Linux) Latest versions of make and gcc (or clang)
Build steps:
Clone this git repository (building outside of git repository is not supported)
In the root of the cloned repository run dotnet build runtime.csproj -c Debug
or dotnet build runtime.csproj -c Release
instruction in your command prompt.
NOTE: runtime.csproj
is not a real C# project file but a kind of build script. To work with the managed part of Gmod.NET open gm_dotnet_managed/gm_dotnet_managed.sln
solution file in your IDE instead.
runtime.csproj
build script will produce following folders in the root of repository:
build
folder contains the full build of GmodDotNet runtime (both native and managed). The content of this folder should be copied to garrysmod/lua/bin
.
Modules
folder contains tests suit. To run tests this folder should be copied to garrysmod/lua/bin
.
nupkgs
folder contains GmodNET.API
NuGet package.
You can find latest nightly builds of Gmod.NET runtime at http://nightly.gmodnet.xyz/. To use our nightly NuGet packages connect to our nightly NuGet feed.
Download latest build from the project's releases page.
Unpack archive for your OS to the %GARRYS_MOD_ROOT_FOLDER%garrysmod/lua/bin/
folder.
Create a Modules
folder inside garrysmod/lua/bin/
.
Place your .NET module, ...deps.json file, and all dependencies in Modules/%exact_name_of_the_module_without_dll%/
folder.
Load Gmod.NET runtime in game by executing Lua function require("dotnet")
.
Load your module by running Lua function dotnet.load("%exact_name_of_the_module_without_dll%")
.
For more info check out our quick start guide.
Whole project is licensed under MIT License.
See the NOTICE file.