How to add folders in Source Safe? - visual-sourcesafe

I have a static site of html and css files. It has folders on my computers. I see an 'add files' option in Source Safe 8 but it only copies files from the root folder.
How can I get Source Safe to copy the whole folder tree structure and their files?

To copy the entire directory tree, create the root folder ("Create Project") in visual source safe. Then from Windows Explorer select all files and folders you want to add to this new project (folder).
It should prompt you for a comment. Enter your note and click ok. That should add all files and folders.
If you only need to add a folder, drag the folder in to it's root in VSS. It will create the folder in VSS.
I think VSS always calls folders "projects".

Yes, drag and drop the folder, check the recursive box at the bottom where you add your comment for the initial check in. This copy all subfolders and files.

I completely agree with the suggestion of using a better option, however if Source Safe is what you use I believe its in the menus as "Create Project" to manually create folders.

Its been a bit since I've used Source Safe, but IIRC, you should be able to just drag and drop a directory into your Source Safe project and the entire tree will be added.

just drag and drop the folder from explorer into the folder in sourcesafe.

Related

Visual Studio: Add existing folder(s) to project

Is there a way to add existing Folders to a Visual Studio Project so that I do not have to do this file by file?
Edit
To make it clear: I want to add references not copies.
If the folder and its contents have already been created and it physically exists under the Project, you can click the Show All Files icon (at the top of the Solution Explorer windows) and then when the folder shows as a dotted icon, right-click it and choose Include In Project and the folder and all its contents are added.
VS 2019
Click on the 'Show All Files' icon at the top of Solution Explorer window.
Then the folders/files of the selected project will be displayed as dotted icons. You can right click any of them and select include in project to include them in the project.
For solution folders, click the 'Show All Files' icon then first exclude the desired folders/files and then include them.
You could open Add Existing Item dialog, select a bunch of files, click on Add's button drop-down menu and choose Add as a link. It will add files as references and won't copy them.
You can drag and drop the entire folder. If all files don't show you can repeat the drag'n'drop procedure for subfolders.
#Mark s answer is good, but if there are hundreds or thousands of files it will be quite cumbersome to add all of them. Plus, it does not provision for new files.
There is another method using the .csproj file. I have used this to add content that is part of a submodule that does not have a .csproj file of its own.
Note that I have used the <Content /> tag, as I did not need any of the linked content during compilation.
<ItemGroup>
<Content Include="..\my\submodule\directory\**" Link="Directory\In\Main\Project\%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
This answer applies to visual-studio-2012 and visual-studio-2013, the most up to date versions at the time the question was asked and this answer was given. More recent versions have improved their handling and have other answers here. For someone using the old versions, this answer still applies.
Answer:
I don't think there is, but if you have all the files in one folder, you can add multiple files in one go. Just mark them all in the add file dialog.
right click the project, and choose "New Solution Explorer view", a window pops up.
and then form the toolbar of the new window ("solution explore window"), you click the "Show All Files" icon.
then include the folders of interest into your project...
If you're working in VS 2019 Community Edition, I find that you can:
Open the parent folder of whatever folder you're trying to add in windows explorer
Right-click and copy that folder
Go to the solution explorer in visual studio
Right-click then paste the folder wherever you want to in the solution tree
In Visual Studio 2019 I could not drag and drop from file explorer or 'Show All Files' and then add them. Instead, while in File Explorer, right click and choose copy, then click on the location within Visual Studio 2019 and right click and choose paste. All of the files in the folder and subfolders will be added.
kburnik's answer worked well for my use-case, but for anyone who needs a scriptable way to bring a lot of folder hierarchy back, you can modify the .*proj file to re-include the folders and files:
<?xml version="1.0" encoding="utf-8"?>
<Project ...>
...
<ItemGroup>
<Compile Include="Path\To\File1.ext" />
<Compile Include="Path\To\File2.ext" />
...
</ItemGroup>
<ItemGroup>
<Folder Include="Only\Empty\Folders\Need\To\Be\Listed\Here" />
...
</ItemGroup>
Just make sure that before you do this, you save the .*proj file if it's still open in Visual Studio.
You can drag and drop the entire folder or missing folders in the project.
If the folder and its contents have already been created and it physically exists under the Project then click on view over the project then you can see all folders and files and you just need to copy files and click on solution in the same folder view and paste all in there
It has been a while since this was originally posted, but here is an alternative answer for a solution folder that is NOT inside of a project. If you only care to be able to look at the physical files from inside visual studio and do not necessarily require to see them in the solution explorer default view, then click on the switch view button and choose the folder view and any physical directory/directories that are under your solution root folder will appear here even if they do not appear in the solution explorer default view.
If however, you want to add a folder tree that isn't too large as a virtual solution directory/directories to match your existing tree structure, do that and and then "add the existing" physical files to the virtual directory/directories. If the physical directory exists in your solution directory it will not copy the files - it will link directly to the physical files but they will appear as part of the solution virtual directories.
Possibly some of you weren't born when this question was first asked!
If you have external directories, you can add them to a solution as a "website". This gives you all the benefits of being able to search through the solution and easily add new files to the website. It doesn't have to contain html, it can be a set of word documents, for example.
So for example, I've got a single solution that contains every sql and oracle query I've ever worked on or harvested from a co-worker. Why? Because it's difficult to keep up with similar sounding field and table names across different databases when you're trying to write a new query.
This also works with TFS.
Check whether that folder is inside project folder or not, if yes:
click Show All files in solution explorer.
now you can see folder name in solution explorer. right click the folder -> Include In Project.
If the folder out of project please copy it into the project directory in the place where we want it.
If your folder exist in another project but you want to add the folder and its content to another project just
-- go to the folder location
-- Copy your desired folder
-- go back to your current project
-- right click on the project and then just paste it.
folder will be added in your current project.
you may need to fix the namspace of the copying file.
You can use the following extension to add a solution folder, which is going to have the same name and the same content as the existing one without it being moved in the file system at all.
Folder To Solution Folder
And here's the link for more information:
https://marketplace.visualstudio.com/items?itemName=CeciliaWiren-CeciliaSHARP.FolderToSolutionFolder
Just drag and drop the folder in solution explorer.

On add existing item in VS2010, why can't I "add as link" a file from the same project?

I have two folders in my library project, folder A and folder B. Folder A will contain all the real files, but Folder B (and a bunch of other folders) need to contain links to the folder A files.
I tried going Add existing item (go to folder A)-> add (down arrow) -> add as link but the add existing item dialog window just closes and nothing happens. It seems I can add links to files outside the library project though. What's going on here?
-Isaac
For some reason Visual Studio seems to silently ignore possible problems with adding file as a link. I just had the same problem and the solution was to:
Check if project folder already contains a file with the name of file being linked, if so delete or rename this resource.
Visual Studio 2010 seems to cache project directory contents, as (1) was not enough to successfully link the file. Restarting VS helps.
Sound like Visual Studio is crashing for some reason. I just tested this in project that has many folders. I had an images folder and I was able to add as link and image to another folder, so it seems it is possible.
It does add the file to the project but does so to the original location, not the new location.
You can see this if you exclude the original file from your VS project (but don't delete the file from disk) - the file will then get add to your project in it's original location
e.g. if you have folder FolderA\index.htm and FolderB, and you want to create a link to index.htm in FolderB. Exclude index.htm from your project (but leave it in FolderA on the disk) so your project just has two empty folders. Right-click on FolderB and click Add Existing Item, select index.htm from FolderA and click Add as Link. The file will be added to your project but under FolderA (where it resides on disk) not within FolderB which is where you told it to add it.
So looks like a VS bug to me.
As has been mentioned, this is a valid scenario if you have multiple "root" websites within one project but you want to share resources between them
In my case (using Visual Studio 2013) I just had to show all files (button on the top of the Solution Explorer), right click on each file/folder and click on "Include on Project".

How to add an existing folder on a solution level in vs 2008?

I renamed a folder using Tortoise SVN which creates a new folder.
Now I want to add it again but there is no add existing folder option and I can't show all files at the solution level.
How can it be done?
EDIT:
I know that solution folders are virtual, I would like to import an existing hierachy.
Folders on the solution level correspond to projects. So just add the existing project file (.csproj, .vbproj, .vcproj) to your solution from the new folder (if you have a reference to the project at the old location in your solution, remove it first).
However, if you are talking about a subfolder within a project, quickest way to get it right is to open the project file with a simple text editor like notepad, find the old folder name within there and rename it manually.
It cant be done. Solution folder are 'virtual'. Solution files are just links to the actual file location.

Add an existing folder to TFS source control

Is there any way I can add an existing folder to source control in TFS? I have created a new folder outside of TFS, just in the file system, and would like to add it to source control, but the only apparent way to do this is the ridiculous workaround of renaming my new folder to a temp name, then creating the new folder in Source Control Explorer, then adding the items from my renamed, original new folder.
Just select the folder after selecting the "Add Items to Folder..." option. You can get to this is from the context menu you get when right clicking on a folder (either the name or the actual folder itself).
The next page of the wizard will present you with lists of included and excluded files. Select the files you want and then hit "Finish".
Then submit the pending changes.
Let me share you a easier way that I just figured out.
(I was having the same trouble, and that is why I found this post.)
Drag the folder you want to add to the solution explorer and drop at the place you want to add.
Ta Ta ! It is done.
Mine is VS2010.
Before dragging and dropping or selecting Add Items To Folder, you must map the parent TFS folder to your local drive.
That is, if you want to add a C:\Stuff\HelloWorld directory to the /Top/Projects folder in TFS, you must first map /Top/Projects to C:\Stuff and then add HelloWorld.

What is a solution folder in Visual Studio?

I have a Visual Studio 2008 solution, and I would like to include a real folder in the solution, but not at the project level, instead at the solution level.
I noticed you can right click the solution and add a solution folder, but it comes up as some white folder, and I have my doubts as to exactly what it is supposed to be...
Basically on the file system I have c:\mySolution\myFolder...
I want that myFolder is added to the solution, so that items are also under source control...
I also would like to be able to add physical folders to a solution, but unfortunately you can't do so outside a project.
The best solution I have found is to add a solution folder with the same name as the physical folder (myFolder in your example), then add files from that physical folder to the solution folder.
However Visual Studio does not maintain a mapping between the solution folder and the physical folder which means that:
new files subsequently created in the solution folder using Visual Studio are not automatically placed in the physical subfolder (I think they are created in the solution root folder by default)
files added to the physical folder are not automatically visible in the solution folder, even with "Show All Files".
To add new files, I therefore always create the new file in the physical folder outside Visual Studio, then add it to the solution folder using "Add/Existing Item"
What I have done historically is to create a project for just holding files (DLLs, etc.)
You can do that as well. This project can be named as whatever folder you are trying to create.
Follow this...
Create the solution folder from Visual Studio.
Right click the solution folder to create a new project.
Change the default location path to add the new physical folder name right after it with the back slash. Something like...C:\Project\Test\New Physical Folder
Click the OK button to create the project
Then the new project will be put inside your new New Physical Folder.
You can also add standalone files in a solution folder, and they will be source-controlled. But be wary that VS tends to put these files in the same folder as the solution file - the "Solution Folders" are virtual and don't corresspond to real filesystem folders. To have a real filesystem folders I think you would have to create the structure yourself and then choose "Add Existing Item".
From MSDN:
"If you are working with a solution that contains numerous projects, you can use Solution Folders to organize related projects into groups and then perform actions on those groups of projects."
You don't want what the composer meant in Solution Folder. It made them to organize large solutions into groups.
For your problem, I think this is the job for your Installation Project to collect these files: Installation instructions, Global help, etc...
You can use a solution folder to group files in a solution, but a solution folder doesn't represent an on-disk folder, like its logo suggests. (It can contain file references and project references.)
My prefered solution is to add a Shared project, which is like a folder but with a special icon.
Create your Solution
dotnet new sln -n demoProjectName
e.g. Your solution folder path C:\Projects\demoProjectName>
Create a Project within the same solution Path
dotnet new classlib -n Persistence
From your solution folder path, do this
C:\Projects\demoProjectName> dotnet sln C:\Projects\demoProjectName\ add C:\Projects\demoProjectName\Persistence\Persistence.csproj
Please note: Persistence as used is just a placeholder for your project name. classlib for classLibrary projects and it could be a console project and so on.

Resources