natemcmaster / DotNetCorePlugins

.NET Core library for dynamically loading code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] System.Data.SqlClient could not be found on my plugin

johmarjac opened this issue · comments

Hello,

I have tried this library now with a simple plugin. All my projects reference net8.0-windows as I need WPF user controls in my plugins.
But in not a single project i am in any way referencing System.Data.SqlClient, i am not using it... So why does it throw exception when trying to create a loder?

thanks

Okay, I have tracked the issue down to where the problem comes from. In my Plugin contract I have a reference to System.Windows.Controls.TabItem like this:

public interface IPlugin
{
    string Name { get; }

    TabItem? TabItem { get; }
}

Plugin Implementation as simple as this:

public class Class1 : IPlugin
{
    public string Name => "TEST PLUGIN";

    public TabItem? TabItem { get; } = new TabItem()
    {
        Header = "NModbus",
        Content = new ContentControl()
    };
}

As soon as I have that TabItem reference in there, I get this error when trying to create a loader from that plugin:

image

Why is that?

Edit: When I add all those NuGet Packages:

<PackageReference Include="System.Data.Odbc" Version="8.0.0" />
<PackageReference Include="System.Data.OleDb" Version="8.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
<PackageReference Include="System.Runtime.Serialization.Schema" Version="8.0.0" />
<PackageReference Include="System.ServiceModel.Syndication" Version="8.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" />

then it works. but why is all those packages necessary? any idea?