I have the following project structure
The Main Application references the Plugin Interface. Plugin Interface has no references. Plugin A and Plugin B reference the Plugin Interface.
I am using MEF to load my plugins during runtime.
I want to configure my VS2012 solution in a way, that the plugins are being copied to .\Plugins instead of the root folder. How can I do that?
Note: Currently I am actually referencing Plugin A and B from my Main App, just so they are copied to my output folder, which is an ugly solution.
You can add a post-build event in Visual Studio.
Go into the project properties for Plugin A and click on the Build Events tab and in the Post-build event command line box, enter code similar to the following:
copy "$(TargetPath)" "$(SolutionDir)MainApplicationPath\bin\debug\Plugins\$(TargetFileName)"
Where $(SolutionDir)
is the root folder for the solution including the trailing slash (e.g. C:\DevProjects\MyApplication\
).
You can also change the path to \bin\release
or add it as a second line if you want the compiled files to go into the release folder of the application. Note that this will only be the release compilation when compiled in release mode, if you compile in debug mode and changed the path to \bin\release
you will still only have a debug version in your release folder.