开发者

In which cases does it make sense to have multiple projects in one solution?

开发者 https://www.devze.com 2023-02-17 10:16 出处:网络
I was just wondering, why would somebody want to create multiple projects in one solution, if he could just as easily create a new solution for each project.

I was just wondering, why would somebody want to create multiple projects in one solution, if he could just as easily create a new solution for each project.

What are the best practices/a开发者_运维百科rguments in deciding which setup is better?


Multiple projects in one solution is very common. The norm even. It's very rare an entire program can be captured in one project. A simple example is unit tests. You typically want those in their own project, but the same solution so they remain easily accessible.


If you break up your assemblies so that certain functionality is in certain assemblies but want a solution which is going to use many of those assemblies, then you would include many projects in you solution.

for example if you had one assembly for your data access, one for your business logic and an exeecutable for your front end, you would have each one in a single solution so you could develop and debug all of them in the one place.

Similarly if you want to subdivide some common functionality into its own assembly so that that component can be reused in many solutions then you would have that in its own project but have it as part of the solution so you can add/extend/change it whilst you are developing your main app.

If you only develop applications which depend on compiled dlls which you never need to develop in parallel, then you might never have multiple projects in a single solution, but this is very rare in my experience


Another simple example is when your project require or create libraries. In one project there is the final application and the others contain (third-party) libraries.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号