forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.netstandard
84 lines (55 loc) · 2.94 KB
/
README.netstandard
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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