Let's assume I have a C# Winforms project, MainGUI.
It references another project in the same solution, ControlsLib.
ControlsLib references a third party control suite, such as Infragistics or Telerik controls, and exposes a set of user controls, that are used in MainGUI.
Copy Local is set to true on all the references in ControlsLib, and all the third party DLLs appear in ControlsLib\bin\release.
However I cannot get the third party DLLs to copy automatically to MainGUI\bin\release, which is the folder from which the software's installer is generated (in this case using NSIS)
Therefore the third party control DLLs don't get included in the installation, which leads to a FileNotFoundException at runtime when controls from ControlsLib that depend on the third party DLLs are used.
Is there a "proper" way to do this that I'm not aware of? Previously I've just handled this in a nant build script by copying files around, but I'm starting a new project and I just wanted to check.
Thanks
To add a reference, right click on the References or Dependencies node in Solution Explorer and choose Add Reference. You can also right-click on the project node and select Add > Reference.
In the Project Designer, click the References tab. Click the Add button to open the Add Reference dialog box. In the Add Reference dialog box, select the tab indicating the type of component you want to reference. Select the components you want to reference, and then click OK.
I have just solved this by adding the following post build event command line to the .csproj file for MainGUI (project properties -> build events)
copy $(SolutionDir)ControlsLib\bin\$(ConfigurationName)\Infragistics2*.dll $(TargetDir)
I hadn't realised doing that was so easy actually...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With