I have a self-contained .net core app on Mac, and it contains another .net core app as a plugin. The structure is somewhat like this:
MyApp.app
|---Content
|----MacOS
|---self-contained runtime *dlls and assemblies
|----Resources
|---MyPlugin.app
Once MyApp is running, a user may start MyPlugin. I am hoping to share the runtimes under MacOS. What's the best way to do this?
Here is what I have tried based on what I read and tested, they could be all wrong...:
- Since MyPlugin is using apphost, one way seems working is to set dotnet_root to MyApp/Content/MacOS. Then it will look for something like $DOTNET_ROOT/shared/$name/$version, but since MyApp is self-contained, it doesn't have this structure, which means I would need to make this structure myself.
- I think nethost is made for non .netcore apps to start .netcore runtime, even I use this, it will face the same problem as the first way, I think.
- Since Docker will isolate my app's environment, if I built my app using the .net core docker image, maybe both MyApp and MyPlguin would find the right .NetCore libraries. But I cannot assume users could run Docker.
Is there an easier or official way to do this? Since MyApp is already running when I start MyPlugin, is it possible to just reuse the already started runtime?