natemcmaster / DotNetCorePlugins

.NET Core library for dynamically loading code
Apache License 2.0
1.61k stars 227 forks source link

[Question] How to load a plugin the uses different SDK (Microsoft.NET.Sdk.Web) than Host #235

Closed Simonl9l closed 2 years ago

Simonl9l commented 2 years ago

Hi i'm using version 1.4.0.

I have a Host that running Microsoft.NET.Sdk runtime SDK. I'm looking to launch plugins, some of which provide Web based functionary.

These plugin leverage the Microsoft.NET.Sdk.Web runtime SDK.

Is there a way that I can tell the plugin loader to use the Plugin as the default type resolution host context ?

My current work around is the have the host use the Microsoft.NET.Sdk.Web runtime SDK; but would rather not!

Any recommendations?

I assume need to somehow override the default context?

natemcmaster commented 2 years ago

Try adding this to the host app .csproj file and use the normal SDK.


 <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Simonl9l commented 2 years ago

@natemcmaster - thanks but assume it ends up at the same place as that is what (more or less) .Web does (behind messaging with working directories too), and not otherwise using the dependancies from the plugin as the source, then host...

natemcmaster commented 2 years ago

There is currently no way to support using the Web SDK in the plugin without the host app loading the Microsoft.AspNetCore.App shared framework. The runtime itself doesn’t support dynamically (un)loading shared frameworks.

Simonl9l commented 2 years ago

Thanks