If you end up using one of the LpSolveDotNet.Native.* packages below, because they have a reference to the LpSolveDotNet package, the reference above becomes redundant.
Library Initialization
The second step in setting up your project is to initialize the LpSolveDotNet library.
Because it is a wrapper on top of a native library written in C, it needs to load the native library before we can use LpSolveDotNet which is described in the tabs below.
If you encounter issues with the solutions in the tab for your platform below, you might want to look at the Other .NET Targets tab for a solution instead.
// Call once per process, before any other usage of LpSolve
LpSolve.Init();
Warning
Starting at version 5.0 of LpSolveDotNet, solution below does not work for OSX x86, you need to follow the procedure for Other Platforms (see next tab).
If your application runs on an OS / Architecture that is not listed above, you need to do the following:
Build lp_solve for your OS / Architecture combination.
Deploy the built native library alongside your application.
Follow the procedure for Other .NET Targets (see next tab).
This procedure is a complement to the ones in the other tabs to handle special cases when the lp_solve native library will not load because either:
There are no binaries available on lp_solve website for that platform and you had to build it yourself.
You run within a .NET target that is neither .NET Frameworek, .NETCore 3+ nor .NET 5+ so code falls back to netstandard which does not have a method to load a library.
When building/running your application, your compiler or runtime decided to fallback to netstandard.
In either case your options are either:
Ensure the native library is in a folder in the paths searched by the .NET implementation for libraries before calling LpSolveDotNet.LpSolve.Init().
Tweak the arguments you pass to LpSolveDotNet.LpSolve.Init() when you call it to match your case: nativeLibraryFolderPath, nativeLibraryNamePrefix, nativeLibraryExtension.
Set a custom loader in LpSolveDotNet.LpSolve.CustomLoadNativeLibrary = ... before calling LpSolveDotNet.LpSolve.Init().