Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to specify a sources folder in a Visual Studio project?

I am comming from the Java world where I usually worked with Eclipse and IntelliJ. Both IDE's allowed one to specify a folder in the project directory to be the root folder for my sources. Typically this was a folder named "src" or "source". In Visual Studio 2010 I found an option on the 'Build' tab of the project properties screen that allows me to change the output directory but I was not able to find something for the 'input' directory. Is it possible to define such an 'input' directory?

like image 876
Andreas Avatar asked Apr 08 '11 07:04

Andreas


2 Answers

You can simply add directories into your project. Open up the project in Visual Studio -> Right click on the project -> Add -> New Folder.

You can also link files into the project while they reside elsewhere.

Besides that, using those directories is quite uncommon in .NET so you should think about adapting the common habbits of the new platform to successfully develop for the new platform. Special-purpose solutions tend to do more harm.

like image 147
PVitt Avatar answered Oct 18 '22 08:10

PVitt


In visual studio you can define a "default" root for all your projects. You do so by going to Tools -> Options -> Projects and Solutions and setting the first textbox "Projects location".

After that, you should know and follow how .Net projects are arranged.

Let's say you are creating a website called "TestSite". You will have a root folder with that name, and in that folder you will have a solution file "TestSite.sln" and as many subfolders as the number of projects your solution will be made of. A common scenario could be the following:

  • TestSite.sln
    • TestSite.Bll
    • TestSite.Dal
    • TestSite.Web

That would be three projects, the first two of type "Class library" as they are your business layer and data layer, and the third of type "Web application" or "Mvc application" (which is much better).

You can reference the projects between them, and when you compile you get everything tied together.

like image 32
Matteo Mosca Avatar answered Oct 18 '22 08:10

Matteo Mosca