I have a completly working application which have a main application and seperate modules/program functions stored in dll files. Forms stored in dll files are loaded into FlowLayoutPanel dinamicaly. I would be interested that, are there any downside using this technique? Since at first I had trouble set up project and one other solution would come as having a main application but the modules were also .exe application running its own window.
Asked
Active
Viewed 1,069 times
-1
-
1The concept of using Dlls is pretty established – Feb 20 '17 at 14:33
1 Answers
1
Assuming that you are using Reflection to load DLLs and that it's all loosely coupled (correct use of interfaces). You should have all module projects set up to output as class libraries (this will produce .dll file but no .exe for each module). Dll files for each module can be then automatically copied to the target location using post-build event setting in visual studio (for each module project). This has proven to work quite well for me.
-
Thank you I appreciate your comment. I am using these lines to load custom dll http://pastebin.com/MqAEsq9z . I am pretty new to C#, I've been programing in Delphi for about 2+ years so C# seemed easier to learn. I will definitely look for reflection to load DLLs, Thank you the link I've bookmarked it. – David Cery Feb 20 '17 at 14:55
-
Looking at your code I can confirm that you are already using reflection. – J. Tuc Feb 20 '17 at 14:58
-
@ZsoltOroszlány - One drawback to the method you are using is that the assemblies are loaded into the current AppDomain which means you cannot unload them without unloading the AppDomain (i. e. shutting down the program). While it is not required, you might research how to load your modules into a separate AppDomain. That way you might be able to unload them without stopping the application. One reason for doing this would be to update the modules. Just a thought. – Chris Dunaway Feb 20 '17 at 15:37
-
@ChrisDunaway I feel that the way I should do it would be using AppDomain. So far I got it working by showing the form from the dll by calling `ShowDialog()` http://pastebin.com/qMizm4R9 but as soon as I want to "attach" it into FlowLayoutPanel I get an exception `... of type 'System.Runtime.Remoting.RemotingException' occurred in System.Windows.Forms.dll` – David Cery Feb 20 '17 at 17:53