-
Notifications
You must be signed in to change notification settings - Fork 21
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
Implement support for self-contained .NET project #20
Comments
Related issues and PRs: dotnet/runtime#35465 |
I found a neat workaround to run .NET projects in a self-contained manner which could suffice for most people encountering this issue. What we need to do is to bring dotnet by ourselves. Example:
Because we are bringing all dotnet libraries already, we don't need to build our project as self-contained. Normally building the project is enough. This is how I call it in pythonnet import os
from pythonnet import load
dotnet_root = os.path.abspath('./my-dotnet-directory')
runtime_config = os.path.abspath('runtimeconfig.json')
load("coreclr", dotnet_root=dotnet_root, runtime_config=runtime_config)
import clr
import os
clr.AddReference(os.path.abspath('./my-project/my-project.dll'))
from MyProject import Program
program = Program()
program.ExecuteSync() This way I'm able to run my application as 'self-contained' runtimeconfig.json: {"runtimeOptions": {"tfm": "net6.0", "framework": {"name": "Microsoft.NETCore.App", "version": "6.0.11"}}} |
@vgibilmanno Are you able to run this in linux? I am trying in Ubuntu |
@rishky-msft I'm able to run this on Debian 11 and Windows 11. It should work on Ubuntu too since it is based on Debian |
Why is this only a "workaround"? What are the limitations/risks of doing this? |
Example project available in previous pythonnet issue.
The text was updated successfully, but these errors were encountered: