I want to use lots of stuff that is already created and is stored in a folder.
In a new project I want to use that classes and just add the whole folder,
including the folder itself to keep the project clearly arranged.
How can I add an existing folder to a project?
As the folder is on a concurrent versions system, I do not want to copy / move / create the files and especially the folder.
Can you not "Show all files" in the solution explorer to see the folders and files not in the project, then "Include In Project"
...or did I not understand the question?
Related
I have a Visual Studio Solution containing multiple projects. (One Main Project and rest are used for testing the Main project)
Here, i have a shared folder within the solution which is used by all the projects within the solution.
I need to include the entire shared folder in my Main project instead of adding existed items.
I am using Visual Studio Professional 2015 and i could not find "Add Existing folder" option in Visual Studio.
Adding Existing items to a project will eliminate the folder structure in solution explorer which makes the usage more complex when included file count is huge.
I need to maintain a folder structure within the project.
Moving the shared folder within the project directory and using "Show All Files" option will avoid the issue(tried based on the answers in some links) but it is not accurate in my case as the folder is being used by different projects.
Do i have any way to add existing folder (Outside the Project within the solution) to a project and maintain a folder structure so that the solution explorer looks more readable?
I just found the solution to this issue.
We are suppose to create a Filter (Virtual Solution Folder) within the Project. Option for creating Filter is available on following below steps,
Select Visual Studio Project.
In Solution Explorer, Disable "Show All Files" option.
Note: When "Show All Files" option is enabled, your project will have an option to create a Folder instead of Filter.
Create a Filter/Virtual Solution folder. (Name could be same as the existing folder name outside the VS project in order to maintain readability)
Now, add required existing files to the Virtual Folder Solution from any location.
(Inside/Outside project location)
By following the above steps, one can add set of existing files to a virtual folder structure in Visual Studio Solution. This is equivalent to adding an Existing folder to a Project Solution without copying it.
I have a standalone project that contains some code I'd like to re-used. I created a library project in order to contain that code. There does not appear to be a way to move files from the one project to the other. (cut/paste in solution explorer did not work)
I then manually copied the files in Windows explorer (outside of VS) into the library's main "folder" but they didn't show up in solution explorer either.
Anyone know of a way to do this without having to manually create each file in the library and then copying/pasting the code into the files?
You need to copy the files and paste them into your solution/project folder(s). Once the files physically exist within your solution/project folder structure (Windows FileSystem / Explorer), then you right-click on your project within Visual Studio, select Add then Existing Item. Browse to the location of that file and open it. It will now exist within your project as a code file.
If you have two projects within the same solution, you can simply drag the file from one project to the other within Visual Studio Solution Explorer. That will create a copy of the class in the new project. You can then remove the old one and clean up any code references in the first project.
I am just learning and following a tutorial on how to create a web project. When I create the new project I do see two new folders called bin and obj. I have read what these are but I am confused as to why when they are created they are not 'included'. These folders are white and the others are yellow. If I right click on the folder it provides the option to Include in project. But the other folders provide option to 'Exclude from project. So I have a few questions:
1. Why aren't these folders automatically included in the project?
2. Should I automatically include in the project?
3. Is there any reason not to include these folders in the project?
The bin and obj folders are for temporary files. They are created and filled automatically when you build your application.
Why aren't these folders automatically included in the project?
The files aren't automatically included in the project because they aren't really part of the project. They are the results of the project. In other words, you won't be editing the files in the bin and obj folders directly.
Should I automatically include in the project? 3. Is there any reason not to include these folders in the project?
You should not be including these folders in your project because they are temporary and the contents will be deleted, created, and changed without updating the project (.csproj, .vbproj, etc.) file when you build, rebuild, or clean your solution. Visual Studio looks at the project file to figure out which files to show you through its user interface.
You don't want to be checking for files to include in your bin and obj folders every time you build your solution. Just know that these folders will be used behind the scenes when you debug or publish your web application.
Basically what I'm looking for is what is visual studio 'Save As'.
I have a program that I would like to use as a base for building a couple of other programs off of. For the life of me I cant find out how to simply make a copy of my program so I have a back up of the original. Any ideas? What am I missing?
If you want a copy, the fastest way of doing this would be to save the project. Then make a copy of the entire thing on the File System. Go back into Visual Studio and open the copy. From there, I would most likely recommend re-naming the project/solution so that you don't have two of the same name, but that is the fastest way to make a copy.
Apparently Visual Studio is missing the 'Save As' feature, so you'll have to back up your projects by manually copying them to a new location.
Here's how I do a project "Save As" for C# projects. The challenge is finding all the places where your project name is and giving it a new project name. You need to rename two folders, rename two files, go into .sln to edit project and path, and go into three files and edit the namespace:
Copy project folder.
Rename project folder.
Go into project folder.
Rename the inside project folder.
Rename .sln file.
Edit inside .sln file and rename project and project path.
Go into inside project folder.
Rename .csproj file.
Edit inside Form1.cs and rename namespace.
Edit inside Form1.Designer.cs and rename namespace.
Edit inside Program.cs and rename namespace.
I use Notepad to go inside the .sln and .cs files. It goes pretty fast.
I also use GIT, but there are definitely good reasons for a new project, like when you want to do major tweaks and a new project is appropriate, but you want to quickly leverage off your old project. Maybe Microsoft will add a "Save As" for projects in the future!
Just found a way of doing it that haven't been mentioned yet, go to :
File > New > Project From Existing Code ...
Choose your language, the folder where the project you want to base yourself on is located and the new name of the project and it's type. Done !
I need to add (as link) a complete directory structure that lives under my solution folder but not under any project folder.
Is this possible, i can't seem to find it.
I suppose 1 option is to add a new project type and then add these files under that project..
But it seems not a good way, what type of project type do i add, a c# class project? The files i wish to include are standard XML files and nothing to do with C#
Any ideas or i get around this?
This is possible in Visual Studio 2010 Professional and above. You can add a solution folder and then include files within that folder. Just right click the solution in the Solution Explorer and choose Add|New Solution Folder. Once the folder is added, right-click it and select Add|Existing Item... to add each of the files that you want to access from that folder.
Solution folders are symbolic (i.e. they don't have to map to a single physical location) so you can store shortcuts to files from many different file system locations under the same solution folder.