Tutorials » VisualStudio tutorials »
Introduction to Projects and Solutions
Learn what is project and solution in Visual Studio
If you have done any kind of programming before, you must be familiar with the terms "project", "solution" etc. Do you know what exactly a project and solution means?
What is a project ?
A "project" is a general term representing some kind of related activities, events, programs etc. In programming world, a project means a set of pages, files etc that are related and bound together.
In a software development company, usually the term "project" means a software or application developed for a specific purpose. When a company says "we are starting a new project", it means they are starting development of a new software.
In Visual Studio, the term "project" has a slightly different meaning.
In Visual Studio, a "project" means a program created using Visual Studio. A project contains several related files. A software or application will have several Visual Studio projects.
For example, a company may be developing a software called "Hospital Management System". To develop this software, there may be several projects created using Visual Studio.
In ASP.NET 2.0 onwards, Microsoft has changed the concept of "project". There is no concept of "project" any more in ASP.NET development. Instead, you just have a set of web pages and related files in a folder.
What is a solution ?
Ideally, a solution is a set of related projects. But in case of web applications using ASP.NET 2.0, a solution represents a web site. There is no concept of projects. Web pages and related files are part of a "solution", instead of a "project". But other types of applications (like class library, console application, windows application etc) still have the concept of "projects" and "solution".
In most cases, every "software" will have one "solution" and several "projects" within the solution. For example, assume you are developing a windows software called "Hospital Management System". As a programmer, the first thing you have to do in VS.NET is, create a solution called "HospitalSystem". After you create a solution, you can create and add any number of projects to the solution. If your software is a web application, you just start with creating a "web site". A new solution will be created automatically for you and your web pages and related files will be organized within the solution.
If your software is a web based system, then you will start with creating a "web site". You will not be creating a project. Also, you may not create a solution (it will be automatically created for you when you create a web site)
The concept of "project" still exists for other projects types. Usually, most of the programmers create a project without creating a solution. In that case, Visual Studio will create a new solution with the same name as the project and automatically include the project within the solution.
If you are using VWD, you will not see the option to create a solution. Instead, you can create a "web site" and the solution will be created automatically without your knowledge.
Where is my solution file ?
When you create a web site using VWD, a solution will be automatically created for you. To open your web site again in VWD, you must know the location of the solution file. You can open the web site by double-clicking on the solution name.
The solution files are located in your "Documents and Settings" folder by default. After you create a new web site using VWD, look into the folder
C:\Documents and Settings\<Your Windows Login Name>\My Documents\Visual Studio 2005\Projects\MyFirstProject. You will see a file called "MyFirstProject.sln" (assuming "MyFirstProject" is the name of your web site.)
VWD remembers the name of all recent web sites and shows in the start up page. So, you don't have to search for the solution file under the "Documents and Settings" folder. When you open the VWD, you will see a list of recent web sites you worked with. Just click on the link to open the web site and start working on it.
What is inside a project ?
Since ASP.NET 2.0 does not have the concept of "projects", the below section is applicable only for non-website applications.
As we mentioned earlier, a project contains a set of related files. How does project look like outside Visual Studio?
In simple words, a project is an xml file. When you create a project using Visual Studio or VWD, it creates an XML file. The project file contains some information like version number etc and the list of all files part of the project.
You can use notepad or any other text editor to open the project file and view the contents. When you open a project file using notepad, it will show the contents of the xml file.
But when a project file is opened using Visual Studio, it knows that it need to do something more than just showing the contents of the file. Visual Studio (or, VWD)t will read the contents of the xml file and display the list of files included within the project, organized as a tree view.
You can click on the files in Visual Studio and open the file. Also, you can use the "build" option to compile all the files in the project.
If you are using notepad to create all files and do not have Visual Studio, you can still develop .NET applications. You have use windows explorer to select and open any source file and edit. You will have to use command prompt to compile each and every file separately. But this will be a painfull and time consuming process. Instead, if you are using Visual Studio (or VWD), all your related files will be organized into one project and you can easily open, edit, save or build all files from Visual Studio. All source files in one project will be compiled into one DLL or EXE.
How many projects I need for my application ?
Ideally, all softwares need one project which will be part of one solution. If you are developing a small application, just create a new project and you are ready to proceed.
However, large softwares will need several projects. All web pages will be organized into one project. All the business layer classes will be another project and data layer classes will be a different projects. Some of the utility classes may be organized into another project. Typically, a large software may have 10 to 20 projects part of the solution. Large softwares may even have several solutions.
Next Chapter: How to BUILD a project using Visual Studio
Previous Chapter: Compatibility of .NET and VS.NET versions
More Chapters: Visual Studio Tutorials
More Tutorials: Tutorial Index
Follow us on Twitter: https://twitter.com/dotnetspider