clr.AddReference fails on macOS and Linux with .NET 9 but works on Windows #2515
Replies: 2 comments 1 reply
-
I managed to resolve the issue by adding the directory containing my assembly (pythonnet_minimal.dll) to sys.path before importing clr. For some reasons, it was working with .Nnet8 and stopped working with .Net9. https://github.com/aesim-tech/pythonnet_minimal was updated accordingly. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Is there any update on this? I have same problem. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Environment
Details
It seems that there is a compatibility issue with .NET 9 on macOS and Linux. Calling 'clr.AddReference(path)' fails on these platforms but works on Windows when the library is compiled with .NET 9 and the .NET runtime version is set to “9.0.0”.
I have created a simple repo that reproduces this issue: https://github.com/aesim-tech/pythonnet_minimal. You can check the action that runs on Windows and fails on Linux.
Note: The same code works correctly on macOS and Linux when targeting .NET 8.0.
Steps to Reproduce
git clone https://github.com/aesim-tech/pythonnet_minimal.git
dotnet build
python pythonnet_minimal.py
Beta Was this translation helpful? Give feedback.
All reactions