Adding class libary
-
Sorry for what must be a very basic question, but here goes: My main project is getting too big, so I want to move some of my classes to a class library Once I do that, however, the classes can no longer find the classes in my main project What's the solution? I can see that it could be possible to reference the main .exe from the .dll but doing so seems odd to me because the main .exe also references the .dll. Thanks
-
Sorry for what must be a very basic question, but here goes: My main project is getting too big, so I want to move some of my classes to a class library Once I do that, however, the classes can no longer find the classes in my main project What's the solution? I can see that it could be possible to reference the main .exe from the .dll but doing so seems odd to me because the main .exe also references the .dll. Thanks
Referencing both ways can be done, but not in one solution. However this would just indicate your design is wrong. Classes in your class library should be used by the main app classes and not reference them. If you have to reference them then either move more classes to the class library or move them back into the main app. As to getting too big, we have projects containing hundreds of classes, which is fine when they are organised in a decent folder structure. I have heard of projects that extend to thousands of classes and take up to an hour to build without problems.
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk
-
Sorry for what must be a very basic question, but here goes: My main project is getting too big, so I want to move some of my classes to a class library Once I do that, however, the classes can no longer find the classes in my main project What's the solution? I can see that it could be possible to reference the main .exe from the .dll but doing so seems odd to me because the main .exe also references the .dll. Thanks
Create a class Library... Produce a Dll and then Reference it. This might be the simplest. But do you think all the units by this way may have produced a unseparable block. The main motive of making external class libraries and compile as dll is to create independent module. I recommend you to refactor each classes to produce independent modules and then reference it. I think the compiler is intellegent enough to load the dll when required. I wrote a fine article to demonstrate how dependency between modules might kill your performance. Check it out. Simplify Code Using NDepend[^] So as suggested, To separate classes is not what you are making. If you just want to separate classes, make a folder place them.. and you might call them using a namespace. But if separation is really required, you need to find out classes that are actually independent of other modules(Such as utility classes). Hope you understand. Cheers.. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Create a class Library... Produce a Dll and then Reference it. This might be the simplest. But do you think all the units by this way may have produced a unseparable block. The main motive of making external class libraries and compile as dll is to create independent module. I recommend you to refactor each classes to produce independent modules and then reference it. I think the compiler is intellegent enough to load the dll when required. I wrote a fine article to demonstrate how dependency between modules might kill your performance. Check it out. Simplify Code Using NDepend[^] So as suggested, To separate classes is not what you are making. If you just want to separate classes, make a folder place them.. and you might call them using a namespace. But if separation is really required, you need to find out classes that are actually independent of other modules(Such as utility classes). Hope you understand. Cheers.. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Thanks for your comments... This is not an organizational problem but a performance one. I figured my program would load faster if some of the classes were in a separate dll. But perhaps that is not true (didn't test it yet)