Convert a completed project to a DLL
How can I convert a completed C# project to a DLL, in order to use it in other projects?
I have Googled but lots of results say to open the Class Library, write your code there, then Build Solution and everything will be ok.
But my question is: how can I convert a completed project to a DLL? The project can include lots of Forms etc.
if your code is complete, you need to create a Class project out of it, if you already have a project then only transfer the useful code to the class project for reuse in other projects
or change the output type to class library, you can find that in your project properties under the tab application
If you are using VS2010, go to your solution in Visual Studio,
- Click the 'Project' tab
- Select 'Project Properties' down at the bottom of the menu
- Now in the 'Properties' window click 'Application'. This should show you a menu
- On this menu, select the 'Output type' as 'Class Library'
Now when you compile the project you will get your output as a DLL (.dll) in the relevant bin folder.
I hope this helps.
If you want to hide the fact that the file is an application you can actually just rename .exe to .dll and the program will still work perfectly ;)
In regards to the OP's original question, you could just add the project to any other solution you use and then build against it? There is no requirement for it to be a class library if the projects are in the same solution.
(If anyone knows of issues caused by doing this PLEASE let me know. I have production code running this way!)