Monday, June 8, 2009

VisualStudio 2008 project (*.csproj) and solution ( *.sln)


Visual Studio projects and solutions are conceptual containers to store the data items such as references,data connections, files and folders we use in development.

Solution

A solution can contain one or more projects, other files and meta data.
When you create a new project (file => new => project) Visual Studio automatically creates a solution for that. So that you can add many new project as you want (rightclick on the solution => add => new project) or add existing projects (add => existing project) depending on your requirements.
You can create folders and add non-project related items also.

So, using solution is a good way of handling your system hierarchy. You can have a nice folder architecture using them.

I developed a system using Visual Studio 2008. There, I gave my folder architecture like this:
DB (all the database related stuff), class library (data layer, business layer classes), tools, UI (web application)etc.

So, if I want to refer any of these things it is easier having it in a one solution rather than having seperate projects and folders.

I can navigate through these items using the solution explorer.

Project

Using a project, you can logically manage, build and debug your application.
When you build your project the output will be an assemply file (*.dll or *.exe) .

Visual Studio provides different project templates such as web application, class library and windows application.
You can select the template depending on your functional requirements.

Project items can be code files, references to libraries and data connections.
Visual Studio provides several templates to the project items as well. They can be web forms, html files, XML configuration files etc.

References:
http://msdn.microsoft.com/en-us/library/b142f8e7(VS.71).aspx

1 comment:

  1. Congrats jayani for your first article.

    I have read it and nicely done. On thing i want to point out is its better to have different projects. The benefit is reusability, easy debugging, easly managable.

    ex: data access layer
    if you put it in a class library, then u can use the dll in other projects.

    ReplyDelete