Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Setting Up Environment To Debug In To onnxruntime.dll

pieths edited this page Feb 5, 2020 · 1 revision
  1. Checkout a copy of the onnxruntime repository.

    git clone --recursive https://github.com/Microsoft/onnxruntime
  2. Open an instance of VS2017 Developer Command Prompt.

  3. Make sure that cmake>=3.13 and python>=3.6 is in the path.

  4. If required, checkout a specific tagged version of onnxruntime.

    git checkout -b v1.0.0 v1.0.0
  5. Build the core code base.

    cd onnxruntime
    build.bat --config Debug --build_shared_lib --build_csharp --skip_onnx_tests --skip-keras-test
  6. Build the Microsoft.ML.OnnxRuntime nuget package.

    cd csharp
    msbuild OnnxRuntime.csharp.proj
    msbuild /t:CreatePackage OnnxRuntime.csharp.proj

    The nuget package should be located in [YOUR_ONNXRUNTIME_REPO_ROOT]\csharp\src\Microsoft.ML.OnnxRuntime\bin\Debug. Note, the version of the nuget package (ie. "1.0.0-dev-20200131-1133-b783805f").

  7. Open [YOUR_MLNET_REPO_ROOT]\build\Dependencies.props and update the ONNX version to the version of the nuget package file created in the previous step.

    <MicrosoftMLOnnxRuntimePackageVersion>1.0.0-dev-20200131-1133-b783805f</MicrosoftMLOnnxRuntimePackageVersion>
  8. Open [YOUR_MLNET_REPO_ROOT]\Directory.Build.props and add the new nuget source location to the RestoreSources section.

    <PropertyGroup>
        <RestoreSources>
              https://api.nuget.org/v3/index.json;
              https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
              https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
              https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json;
              https://pkgs.dev.azure.com/dnceng/public/_packaging/MachineLearning/nuget/v3/index.json;
              [YOUR_ONNXRUNTIME_REPO_ROOT]\csharp\src\Microsoft.ML.OnnxRuntime\bin\Debug;
        </RestoreSources>
    </PropertyGroup>
  9. In a new cmd window, rebuild ML.Net and create new custom nuget packages.

    cd [YOUR_MLNET_REPO_ROOT]
    git clean -fxd
    build -debug
    build -debug -buildPackages
  10. Update the NimbusML nuget.config file to include both the ML.Net and onnxruntime package source directories.

    <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
        <add key="local_mlnet" value="[YOUR_MLNET_REPO_ROOT]\bin\packages" />
        <add key="local_onnxruntime" value="[YOUR_ONNXRUNTIME_REPO_ROOT]\csharp\src\Microsoft.ML.OnnxRuntime\bin\Debug" />
        <!-- <add key="MlNet_Daily" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" /> -->
    </packageSources>
  11. Remove the local nuget cache and clean the NimbusML source directory.

    rmdir %USERPROFILE%\.nuget
    cd [YOUR_NIMBUSML_REPO_ROOT]
    git clean -fxd
  12. Build NimbusML using the remaining instructions found here.

Clone this wiki locally