8000 pythonnet fails to load netstandard2.1 library · Issue #1151 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

pythonnet fails to load netstandard2.1 library #1151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
philippdoersek opened this issue May 23, 2020 · 4 comments
Closed

pythonnet fails to load netstandard2.1 library #1151

philippdoersek opened this issue May 23, 2020 · 4 comments

Comments

@philippdoersek
Copy link

Environment

  • Pythonnet version: 2.4.1.dev0 (master-2166)
  • Python version: 3.7
  • Operating System: win10

Details

  • Describe what you were trying to get done.

If I compile a library using <TargetFramework>netstandard2.1</TargetFramework>, then trying to import any symbols from it fails. In contrast, when I compile using <TargetFramework>netstandard2.0</TargetFramework>, with the otherwise identical library, everything works fine.

Are there any plans to support netstandard2.1? What is required to get that working? I'm using the most recent master-2166 build from AppVeyor.

Apologies if this was raised already, I saw some separate discussions on other topics such as .net core, but none mentioning netstandard libraries.

    import clr
    clr.AddReference("My.Library.Name")
    from My.Library.Name import *
  • If there was a crash, please include the traceback here.

ModuleNotFoundError: No module named My.Library.Name

@filmor
Copy link
Member
filmor commented May 23, 2020

AFAIK .NET Framework is not .NET Standard 2.1 compatible. As such, only a .NET Core build of Python.NET will be able to load a .NET Standard 2.1 library. This is being worked on, but it will take a while to land it in master.

@bmiller-pm
Copy link

I currently use this fork of PythonNet for my .Net Core apps.
https://github.com/henon/pythonnet_netstandard

This is built against .NET Standard 2.0. Perhaps our PythonNet gurus are waiting for .NET 5?
This is supposed to unify all standards - based on CoreFx.
https://devblogs.microsoft.com/dotnet/introducing-net-5/#:~:text=NET%20Core%20will%20con 8000 tinue%20to,each%20native%20platform%20from%20Xamarin.

@philippdoersek
Copy link
Author

Thanks @QuickWire for pointing that out, that's actually quite interesting and good to know it exists. However, unless I'm mistaken, I don't think it will resolve my problem because I need the opposite direction (python -> .net, not .net -> python).

@filmor
Copy link
Member
filmor commented Feb 14, 2021

.NET Core support is now merged, docs will follow soon (#984 contains an example).

@filmor filmor closed this as completed Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
2AF1
0