Simple multiple projects add to Visual Studio


Hello all

Today I will explain how to add multiple project in Visual Studio .(That could be use for n-tier architecture or for other purpose). In .NET or in any language its wanted to fragment individual module of a system should have to be separated. In .NET we do this by adding multiple project in a single solution.

First open a new project ( in the example I have used new website named Emp ).

now add a new project from File > Add > New Project ( which will be a layer of Emp Website)

and then select Windows > > Class Library and give a name in the example I have named “DataAccessLayer”.

The initial task has been completed. Now in you solution explorer you will find new project named  “DataAccessLayer” and a default class named Class1.cs which you can rename according to your naming convention.

Now the most vital thing to do is let our main website “Emp” be referenced with the “DataAccessLayer” project ,otherwise we will not be able to use the resource of “DataAccessLayer” in “Emp”  !

To do that we have to select out website “Emp” and right click on it after that we have to select Add Reference .

After a short time a window will came named Add Reference, from there we have to select the Project tab and let select the desired project for us its “DataAccessLayer” then click ok.

the task is done now we will be able to use the “DataAccessLayer” project’s resource from our “Emp” website .

There is little additional task to do ..

We have to define the name of the project                  

using DataAccessLayer;”  at the top of the classes which will use the resource of the “DataAccessLayer” as following.

that’s all for today

Bye 


Leave a Reply