Box2D.NET.Bindings.Release 3.1.0

dotnet add package Box2D.NET.Bindings.Release --version 3.1.0
                    
NuGet\Install-Package Box2D.NET.Bindings.Release -Version 3.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Box2D.NET.Bindings.Release" Version="3.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Box2D.NET.Bindings.Release" Version="3.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Box2D.NET.Bindings.Release" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Box2D.NET.Bindings.Release --version 3.1.0
                    
#r "nuget: Box2D.NET.Bindings.Release, 3.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Box2D.NET.Bindings.Release&version=3.1.0
                    
Install Box2D.NET.Bindings.Release as a Cake Addin
#tool nuget:?package=Box2D.NET.Bindings.Release&version=3.1.0
                    
Install Box2D.NET.Bindings.Release as a Cake Tool

Box2D.NET

<div align="center">

alternate text is missing from this package README image

MIT Nuget (with prereleases)

Examples

</div>

Box2D.NET is a C# binding for Box2D. Low-level bindings to the C api are included and generated with Bindgen.NET. Native libraries are cross-compiled with Vezel-Dev's Zig Toolsets.

There is currently no high-level wrapper but it may come in the future! Box2D.NET and Box2D.NET.Bindings are identical packages.

NuGet

You can download the nuget package and use Box2D.NET right away!

Box2D.NET (Wrapper + Bindings + Native Libraries): Release | Debug

dotnet add PROJECT package Box2D.NET.Release --version *-*

Box2D.NET.Bindings (Bindings + Native Libraries): Release | Debug

dotnet add PROJECT package Box2D.NET.Bindings.Release --version *-*

Box2D.NET.Native (Native Libraries): Release | Debug

dotnet add PROJECT package Box2D.NET.Native.Release --version *-*

Box2D.NET provides both release and debug packages for nuget. To include both of them in your project based on your build configuration, use the package references below. The latest stable or prerelease versions will be added to your project.

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Box2D.NET.Debug" Version="*-*" Condition="'$(Configuration)' == 'Debug'" />
        <PackageReference Include="Box2D.NET.Release" Version="*-*" Condition="'$(Configuration)' == 'Release'" />
    </ItemGroup>

</Project>

GitHub Package Registry

For more up-to-date packages, development builds are available on the GitHub package registry. Packages are automatically uploaded on every commit to the main branch.

To access development builds from your project, you first need to create a GitHub personal access token with the read:packages permission. (See Creating a personal access token (classic))

Once you have created a personal access token, run the following command to add the GitHub feed as a new package source. Replace YOUR_GITHUB_USERNAME with your GitHub username and YOUR_GITHUB_TOKEN with your personal access token.

dotnet nuget add source --name "box2d.net" --username "YOUR_GITHUB_USERNAME" --password "YOUR_GITHUB_TOKEN" --store-password-in-clear-text "https://nuget.pkg.github.com/BeanCheeseBurrito/index.json"

You can now reference any package from the GitHub feed!

dotnet add PROJECT package Box2D.NET.Release --version *-build.*
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Box2D.NET.Debug" Version="*-build.*"/>
    </ItemGroup>
</Project>

By default, the GitHub feed will be added to your global nuget.config file and can be referenced by any project on your machine. If wish to add the feed to a single project/solution, create a nuget.config file at the root of your project/solution directory and run the following command with the --configfile option.

dotnet nuget add source --configfile "./nuget.config" --name "box2d.net" --username "YOUR_GITHUB_USERNAME" --password "YOUR_GITHUB_TOKEN" --store-password-in-clear-text "https://nuget.pkg.github.com/BeanCheeseBurrito/index.json"

To remove the GitHub feed from your NuGet package sources, run the following command.

dotnet nuget remove source "box2d.net"

GitHub Actions workflows can be authenticated using the GITHUB_TOKEN secret.

- name: Add GitHub source
  run: dotnet nuget add source --name "box2d.net" --username "USERNAME" --password "${{ secrets.GITHUB_TOKEN }}" --store-password-in-clear-text "https://nuget.pkg.github.com/BeanCheeseBurrito/index.json"

Development feed packages may be deleted without warning to free up space.

Running examples

To run any of the example programs, use dotnet run and set the Example property's value to the example's full class name. Example:

dotnet run --project Box2D.NET.Examples --property:Example=HelloWorld

Building from source

Clone the repo

Clone the repo and it's submodules.

git clone --recursive https://github.com/BeanCheeseBurrito/Box2D.NET.git
cd Box2D.NET

Restore dependencies

Run the following command on the solution to restore all project dependencies.

dotnet restore

Generate bindings

Generate the binding code. Bindings are generated with Bindgen.NET.

dotnet run --project Box2D.NET.Bindgen

Build Box2D.NET

Compile the bindings and native libraries. The zig compiler will automatically be downloaded and cached in your local nuget package folder. Native libraries will be cross-compiled for linux, macos, and windows.

dotnet build

Reference the project

Reference the project and import the native libraries.

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
    </PropertyGroup>

    <ItemGroup>
        <ProjectReference Include="PATH/Box2D.NET/Box2D.NET/Box2D.NET.csproj"/>
    </ItemGroup>

</Project>
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Box2D.NET.Bindings.Release:

Package Downloads
Box2D.NET.Release

Raw C# bindings for Box2D

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.0 67 5/23/2025
3.0.0 375 8/13/2024
0.0.8 191 6/29/2024
0.0.7 207 3/25/2024
0.0.6 187 3/13/2024
0.0.5 194 2/25/2024
0.0.4 218 1/18/2024
0.0.3 163 1/18/2024
0.0.1 158 1/18/2024