Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27412

Plugins Between Framework and .NET5/6

$
0
0
I have a program that dynamically loads dlls that have plugins. This was written originally in FW4.0, though pretty much everything is FW4.7.2 or 4.8 by now. I thought I might be able to add .NET5/6 plugins, and have run into problems. I will admit that I have not looked at this in great detail, yet, so there is a chance that I missed something simple, but I'm thinking probably not.

The code I use to load plugins is this:

Code:

Dim dirLoc = "SomeFolder"
        If IO.Directory.Exists(dirLoc) Then
            For Each fl As String In IO.Directory.GetFiles(dirLoc, "*.dll")
                Try
                    Dim aDLL As System.Reflection.Assembly = System.Reflection.Assembly.LoadFile(fl)
                   
                    If aDLL IsNot Nothing Then
                        Dim tArr As Type() = aDLL.GetExportedTypes

The rest doesn't matter for this question, because the problem is in the very last line. When I tried making a plugin written in .NET5, it created just fine, but when I tried to load that plugin, it failed on that last line with a File Not Found exception.

The little bit of research I did showed that one of the changes from Framework to Core was that GetExportedTypes() was removed in favor of a different mechanism. Therefore, I think it might be possible to identify whether the Assembly is Core or Framework (I haven't even looked at how that would be possible, but I assume it would be), then use a different mechanism to get the types from the Assembly if it is Core.

What I need to be able to do is get types from dlls that are either framework or core. So, my question is: Has anybody done something like this, and can they show me what needs to be done?

Viewing all articles
Browse latest Browse all 27412

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>