csharp build documentation (#5121)

This commit is contained in:
Ashwini Khade 2020-09-11 11:46:10 -07:00 committed by GitHub
parent 15d431f39b
commit cd56ab197c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 34 deletions

View file

@ -124,8 +124,7 @@ GCC 4.x and below are not supported.
|API|Command|Additional details|
|-----------|-----------|-----------|
|**Python**|--build_wheel||
|**C# and C packages**|--build_nuget|Builds C# bindings and creates nuget package. Currently supported on Windows and Linux only. Implies `--build_shared_lib` <br>
Requires [dotnet](https://dotnet.microsoft.com/download) for building csharp bindings and [nuget.exe](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools#nugetexe-cli) for creating nuget package.|
|**C# and C packages**|--build_nuget|Builds C# bindings and creates nuget package. Currently supported on Windows and Linux only. Implies `--build_shared_lib` <br> Detailed instructions can be found [below](./BUILD.md#build-nuget-packages).|
|**WindowsML**|--use_winml<br>--use_dml<br>--build_shared_lib|WindowsML depends on DirectML and the OnnxRuntime shared library|
|**Java**|--build_java|Creates an onnxruntime4j.jar in the build directory, implies `--build_shared_lib`<br>Compiling the Java API requires [gradle](https://gradle.org) v6.1+ to be installed in addition to the usual requirements.|
|**Node.js**|--build_nodejs|Build Node.js binding. Implies `--build_shared_lib`|
@ -137,6 +136,26 @@ Read more about ONNX Runtime Server [here](./docs/ONNX_Runtime_Server_Usage.md).
Build instructions are [here](./docs/Server.md)
## Build Nuget packages
Currently only supported on Windows and Linux.
### Prerequisites
* dotnet is required for building csharp bindings and creating managed nuget package. Follow the instructions [here](https://dotnet.microsoft.com/download) to download dotnet. Tested with versions 2.1 and 3.1.
* nuget.exe. Follow the instructions [here](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools#nugetexe-cli) to download nuget
* On Windows, downloading nuget is straightforward and simply following the instructions above should work.
* On Linux, nuget relies on Mono runtime and therefore this needs to be setup too. Above link has all the information to setup Mono and nuget. The instructions can directly be found [here](https://www.mono-project.com/docs/getting-started/install/). In some cases it is required to run `sudo apt-get install mono-complete` after installing mono.
### Build Instructions
#### Windows
```
.\build.bat --build_nuget
```
#### Linux
```
./build.sh --build_nuget
```
Nuget packages are created under <native_build_dir>\nuget-artifacts
---
## Execution Providers

View file

@ -176,35 +176,4 @@ Below topologies from ONNX open model zoo are fully supported on OpenVINO Execut
## CSharp API
To use csharp api for openvino execution provider create a custom nuget package. Two nuget packages will be created
Microsoft.ML.OnnxRuntime.Managed and Microsoft.ML.OnnxRuntime.Openvino.
1. Windows
Build a custom nuget package for windows.
```
.\build.bat --config Debug --build --use_openvino $Device --build_csharp
msbuild csharp\OnnxRuntime.CSharp.proj /p:OrtPackageId=Microsoft.ML.OnnxRuntime.Openvino /p:Configuration=Debug /t:CreatePackage
```
The msbuild log will show the paths of the nuget packages created.
2. Linux
We currently do not have a process to build directly in Linux. But we can
copy shared library <ORT linux repo>/build/Linux/<config>/libonnxruntime.so
to onnxruntime source repository in windows and execute the same commands
above to get custom nuget package for linux. Two nuget packages will be
created Microsoft.ML.OnnxRuntime.Managed and Microsoft.ML.OnnxRuntime.Openvino.
On Linux Machine
```
./build.sh --config Debug --build_shared_lib --use_openvino $Device
```
On Windows Machine
```
cp libonnxruntime.so onnxruntime/
.\build.bat --config Debug --build --use_openvino $Device --build_csharp
msbuild csharp\OnnxRuntime.CSharp.proj /p:OrtPackageId=Microsoft.ML.OnnxRuntime.Openvino /p:Configuration=Debug /t:CreatePackage
```
The msbuild log will show the path of the nuget packages created.
To use csharp api for openvino execution provider create a custom nuget package. Follow the instructions [here](../../BUILD.md##build-nuget-packages) to install prerequisites for nuget creation. Once prerequisites are installed follow the instructions to [build openvino](../../BUILD.md#openvino) and add an extra flag `--build_nuget` to create nuget packages. Two nuget packages will be created Microsoft.ML.OnnxRuntime.Managed and Microsoft.ML.OnnxRuntime.Openvino.