This is just a quick note about a problem I encountered while creating plugins.
In this case, I am not creating NuGet packages for my plugins. The idea here is for each plugin to create a folder with all its required content. That folder would be copied to another location for the client app to consume. This is a model I see often used for games and is the model I am trying for here. I mention this because many of the posts I saw while trying to fix my issue included getting sidetracked by the fact that NuGet was involved.
So, what I am trying to accomplish is to have the Plugin_A project compile into the /bin/Release/net5.0/ folder. The contents of that folder would become my /Plugin_A
And now, my problem…
When I compiled my Plugin_A project using Visual Studio 2019, I found that it did put the plugin’s DLL into the /bin/Debug/net5.0/ and /bin/Release/net5.0/ folders. But the plugin references other DLLs, like HtmlAgilityPack.dll and System.ServiceModel.Syndication.dll, and these were not in the /bin folders. That would mean that when I copied the /Plugin_A folder to /PutPluginsHere, the client application would find Plugin_A.dll, but could not load it because it would be missing dependencies.
I searched the net to try and find out how to ensure that HtmlAgilityPack.dll and System.ServiceModel.Syndication.dll were copied to the
/bin folders, but the majority of the answers ended up being workarounds like using xcopy to force the missing DLLs to be copied and other such manual methods.
I finally did find the solution. It involves adding one line to the Plugin_A.cproj file:
Adding that line inside the
<PropertyGroup> tag solved the issue. The dependent DLLs are now copied to the /bin folders. You can read what Microsoft has to say about it here.