Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRanvir Sahota
9,844 PointsWhat is a project in visual studio?
I understand a solution consists of many projects around one idea. But then why do you create multiple projects? What tests do you have to run in order to create a new project? Could you not just have one project and run the tests on that?
1 Answer
Allan Clark
10,810 PointsA big benefit to multiple projects in the same solution is having separation of concerns. Of course for most smaller one off apps one project is fine, but when you get into developing for a company in an Enterprise environment with multiple developers working on the same solution it can sometimes be advantageous to have separate projects.
For a real world example, the company I work for is in the process of upgrading their company wide intranet site, as well as developing an API. Both projects will need access to the same DB structure so we plan to separate out the DB classes (Entity Framework) into its own Class Library (a separate project in the same solution) and reference the Class Library where its needed. This will allow us to have only one place that we need to worry about keeping synced with the DB.
You only need to right click on your solution in the solution explorer then add => new project to create another project in your solution. I will need some clarification on the questions about testing. Tests are a really really really good idea, but not required.
Ranvir Sahota
9,844 PointsRanvir Sahota
9,844 PointsThanks for your quick response. So different projects can interact with each other? So white box testing with multiple projects separated correctly is really great, right? But the how does black box testing work in this regard when you control the input and output parameters? How do you get different projects to interact with each other to allow for additional testing such as black box and for the release of the software? I maybe digging into this a bit too much so I don't mind a simple explanation as its better than nothing but if you're up for more then please do! Thanks
Allan Clark
10,810 PointsAllan Clark
10,810 PointsWell there are a lot of ways for multiple projects to interact with each other so isn't one good answer for this question it really depends on solution as a whole. For my Class Library example anything test that touches the DB would use that project. But with Xamarin it has one shared project and individual projects for the different platforms so no testing would hit all of the projects.