Skip to content

Issue with onnxruntime.dll not found in .NET 7.0 project #7214

Open

Description

Hello,

I am encountering an issue with my .NET 7.0 project using ONNX Runtime. Despite having Microsoft.ML.OnnxRuntime.dll in my project, the application fails with an error indicating that onnxruntime.dll cannot be found.

Here are the steps I followed:

I ensured onnxruntime.dll is located in bin\Debug\net7.0\runtimes\win-x64\native.
I manually copied onnxruntime.dll to bin\Debug\net7.0, but the issue persists.
I updated my .csproj file with the following configuration to copy the DLL automatically:
<ItemGroup> <None Update="runtimes\win-x64\native\onnxruntime.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> </ItemGroup>
The application crashes at the following line without throwing an error:
NativeApiStatus.VerifySuccess(NativeMethods.OrtCreateSessionOptions(out handle));
However, the problem remains unsolved. I would appreciate any guidance on resolving this issue.

Environment:

.NET 7.0
Microsoft.ML.OnnxRuntime version [1.18.1]
Windows [11]
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    onnxExporting ONNX models or loading ONNX modelsuntriagedNew issue has not been triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions