Question

I want to create a new project in C# using VS2010 and I wonder what's the best organization in this project. I have some experience with Maven and what I want here it's something that will be as organized as the Maven folder scheme. THe project it's an API client so my goals are:

  1. Create a deployable module with the API access code;
  2. Create another module with a Main in order to see the client working;
  3. Create another module with automatic testing to test the client.
  4. If the option before requires several projects/solutions, I want to be able to click in one file and VS already have all of the projects opened.

What's the best approach in VS without using any thrid-party tool? I want to automatically deploy the client assembly without having the unit and main code and have the unit code also separated from the rest.

Was it helpful?

Solution

I could be misunderstanding your question - I don't have a lot of experience with API clients, but I'm wondering if what you're really after is a better understanding of solutions. A VS solution allows you to logically group multiple projects, giving you what you're looking for in option 4.

With that in mind, I'd have a single solution, and then a project for your requirements 1-3.

Sorry if that's way off base or over simplified.

OTHER TIPS

Yup, so very much like Bobby explained, a solution allows you group multiple project which you can open from a single .sln file. A close analogy is something like an EAR project in eclipse although in eclipse you don't get to see a single file you click on to open only the projects in your solution.
So for your "solution", you can use an empty solution, add class library project for your API code, you can add a console application for your test project and add a reference to your API class library, you will put your test project in a separate class library for test which will also reference the API library.
For the kind of automated builds you get with maven, you can check out MSBUILD for starters.

Scott Hanselman wrote a very good blog post on how his team organizes their code. It covers not only how their code is physically organized on the drive, but the thinking behind the organization.

Scott Hanselman's Computer Zen: How do your organize your code?

The post is now very old, but the approach that team uses would let you accomplish most, if not all of what you are trying to do. He also mentions some nice free tools for builds, testing, code coverage, and build visibility.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top