create tool to generate signing key when sn.exe is not present add build info to readme add DOTNET_INSTALL_PATH to Makefile.local and try to detect
84 lines
2.9 KiB
Plaintext
84 lines
2.9 KiB
Plaintext
This file describes how to use the or-tools .NET standard binary archive.
|
|
|
|
OR-Tools is located at https://developers.google.com/optimization
|
|
|
|
These modules have been tested under:
|
|
- Mac OS X High Sierra with Xcode 7.x (64 bit).
|
|
- Microsoft Windows with Visual Studio 2017 (64-bit)
|
|
|
|
Upon decompressing the archive, you will get the following structure:
|
|
|
|
or-tools/
|
|
LICENSE-2.0.txt <- Apache License
|
|
README <- This file
|
|
data/ <- Data for the examples
|
|
examples/ <- Netstandard examples
|
|
bin/ <- Directory containing assemblies, native libraries, and nuget package
|
|
|
|
To build an example, open the folder in the command prompt and type the following commands:
|
|
|
|
dotnet restore
|
|
dotnet build
|
|
|
|
To run an example, open the folder in the command prompt and type the following commands:
|
|
|
|
dotnet restore
|
|
dotnet run
|
|
|
|
* Using NuGet Package Directly
|
|
|
|
To use the nuget package directly a local feed is required. Create a folder where the packages
|
|
will be stored. Create a nuget.config that references this folder. Copy the nupkg file to the
|
|
package folder.
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<configuration>
|
|
<packageSources>
|
|
<add key="local" value="../PackageStore" />
|
|
</packageSources>
|
|
</configuration>
|
|
|
|
To install the nuget package use the following command:
|
|
|
|
dotnet add package Google.OrTools.Core
|
|
dotnet restore
|
|
|
|
* Referencing Directly
|
|
|
|
Or-Tools for .netstandard includes two libraries, a library containing managed code and a libraries containing native code.
|
|
If a reference is made directly to the managed library, Visual Studio will not copy the native dll to the output folder.
|
|
|
|
A post build step is required to copy the file. In Visual Studio this can be added by selecting the "Build Events" tab in
|
|
project properties. Use the copy command example below to copy the file:
|
|
|
|
xcopy /Y "..\..\lib\ortools\Google.OrTools.Native.dll" "$(TargetDir)"
|
|
|
|
The project file can be modified in any text editor as well:
|
|
|
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
|
<Exec Command="xcopy /Y "..\..\lib\ortools\Google.OrTools.Native.dll" "$(TargetDir)"" />
|
|
</Target>
|
|
|
|
* Building
|
|
|
|
To build use the following command:
|
|
|
|
make netstandard
|
|
|
|
The .NET Core SDK 2.0 or later must be installed before building. Use the link below to find appropriate
|
|
download for the build platform.
|
|
|
|
https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md
|
|
|
|
Alternatively the command below can be used to install the SDK:
|
|
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 2.0
|
|
|
|
The build will attempt to detect the SDK path. If there are any issues please check the
|
|
DOTNET_INSTALL_PATH variable in the Makefile.local file:
|
|
|
|
DOTNET_INSTALL_PATH=C:\Program Files\dotnet
|
|
|
|
The dotnet restore command will not update the nuget packages if the version does not change. This
|
|
can cause confusion when testing local builds. Use the command below to clear the package:
|
|
|
|
dotnet nuget locals all --clear |