I have a folder that contains basically all the C# classes that I use and I would like the 4 projects that I have to share those same classes that are inside that folder. I have not found a way to do it, I have put them in each project because I do not know how to make them all adopt the classes that are there.
- folder with classes inside
- Solution1
- Solution2
- Solution3
- Solution4
The solutions are all inside the same folders, that is, in the Solutions folder are all the folders of each solution and the one of the folder that I need to share.
The solution to this problem is as follows: Create a Library project (Class Library) in which you add the classes that are common to all other projects, compile it and it will create a .dll file for you; then in each in each project that requires those classes, you add a reference to the created .dll file. When you compile the Library project (Class Library), assuming that your project is called "Class_Folder", the .dll file will generally be located in the following path
Carpeta_clases\Carpeta_clases\bin\Debug\Carpeta_clases.dll
, you add a reference to that file in each project and that's it. The way to refer to each class and its properties and functions is the same way you use, for example, to refer to the classSystem.Windows.Forms
, this class is nothing more than one of the classes included in an assembly generally located inWindows\Microsoft.NET\Framework\v2.0.50727\System.dll
.