I'm working on a plugin system for my app (C#, WPF). My project structure is like this:
Solution 'App'
Plugins (solution folder)
Plugin1 project (dll)
Plugin2 project (dll)
MainApp project (WPF)
PluginInterface project (dll)
I edited projects' properties to build them in a custom folder this way
Build
Debug
MainApp.exe
PluginInterface.dll
Plugins (folder)
Plugin1.dll
Plugin2.dll
As the plugins should implement Iplugin
interface (in PluginInterface project), I added PluginInterface project to references for each plugin project. However, this causes Visual Studio to build a copy of PluginInterface.dll in Plugins folder while PluginInterface project's output path is just set to Build\Debug.
I also tried to reference to the PluginInterface.dll file in Build\Debug (not project) but the result is same (I didn't forget to delete all created files before build).
How should I prevent Visual Studio from duplicating PluginInterface.dll file?
You could always remove the file afterwards with an msbuild task;
https://learn.microsoft.com/en-us/visualstudio/msbuild/delete-task?view=vs-2019
Or with a post-build script;
del $(ProjectDir)\plugins\pluginInterface.dll