Using OR-Tools NuGet for .Net


This guide gets you started with OR-Tools in .Net with a simple working example.

Although these instructions might also work on other Windows variants, we have only tested them on machines meeting the following requirements:

Windows 10 64-bit (x86_64) with:

  • Microsoft Visual Studio Enterprise 2022
  • Microsoft Visual Studio Community 2022 Preview 2 or above


The following sections describe the prerequisites for installing OR-Tools.

Microsoft Visual C++ Redistributable

You must have the Microsoft Visual C++ Redistributable for Visual Studio 2022 (select the x64 version) installed on your computer, since OR-Tools library for .Net is a wrapper for the C++ native library.

.NET Core 3.1 SDK

You must install the package .NET Core 3.1 SDK version 3.1.100 or higher from the following location: sdk-3.1.425-windows-x64-installer

.Net 6.0 SDK

You must install the package .NET 6.0 SDK from the following location: sdk-6.0.403-windows-x64-installer

Get the .Net example code

The example code is located in the dotnet_or-tools repository.

  1. Download the repository as a zip file and extract it, or clone the repository:

    git clone -b v9.10 --depth 1
  2. Change to the examples directory:

    cd dotnet_or-tools

Build the example

From the dotnet_or-tools directory:

Build the project using:

dotnet build -c Release

Run the example

From the dotnet_or-tools directory:

Run the binary using:

dotnet run -c Release

Congratulations! You've just run an application with OR-Tools, you are ready to get started with OR-Tools.