@@ -866,13 +866,30 @@ static NativeMethods()
866866 internal class NativeLib
867867 {
868868#if __ANDROID__
869- // define the library name required for android
869+ // Define the library name required for Android
870870 internal const string DllName = "libonnxruntime.so" ;
871871#elif __IOS__
872- // define the library name required for iOS
872+ // Define the library name required for iOS
873873 internal const string DllName = "__Internal" ;
874874#else
875- internal const string DllName = "onnxruntime" ;
875+ // For desktop platforms, explicitly specify the DLL name with extension to avoid
876+ // issues on case-sensitive filesystems (including Windows with case-sensitivity enabled).
877+ //
878+ // Previous behavior relied on .NET automatically adding platform-specific extensions:
879+ // Windows: onnxruntime -> onnxruntime.dll
880+ // Linux: onnxruntime -> libonnxruntime.so
881+ // macOS: onnxruntime -> libonnxruntime.dylib
882+ //
883+ // By specifying "onnxruntime.dll" explicitly, we ensure consistent behavior across
884+ // case-sensitive and case-insensitive filesystems. This requires that native libraries
885+ // for all platforms be named "onnxruntime.dll" in their respective runtime folders,
886+ // or that appropriate symlinks/aliases be created during packaging.
887+ //
888+ // NuGet packages should contain:
889+ // - runtimes/win-{arch}/native/onnxruntime.dll
890+ // - runtimes/linux-{arch}/native/onnxruntime.dll (symlink to libonnxruntime.so)
891+ // - runtimes/osx-{arch}/native/onnxruntime.dll (symlink to libonnxruntime.dylib)
892+ internal const string DllName = "onnxruntime.dll" ;
876893#endif
877894 }
878895
@@ -2951,7 +2968,9 @@ internal static class OrtExtensionsNativeMethods
29512968#elif __IOS__
29522969 internal const string ExtensionsDllName = "__Internal" ;
29532970#else
2954- internal const string ExtensionsDllName = "ortextensions" ;
2971+ // For desktop platforms, explicitly specify the DLL name with extension to avoid
2972+ // issues on case-sensitive filesystems. See NativeLib.DllName for detailed explanation.
2973+ internal const string ExtensionsDllName = "ortextensions.dll" ;
29552974#endif
29562975
29572976 [ DllImport ( ExtensionsDllName , CharSet = CharSet . Ansi ,
0 commit comments