Add an existing folder to TFS source control

59,349

Solution 1

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.

Solution 2

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.

Solution 3

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.

Share:
59,349
ProfK
Author by

ProfK

I am a software developer in Johannesburg, South Africa. I specialise in C# and ASP.NET, with SQL Server. I have, in some way or another, been involved in software development for about eighteen years, but always learning something new. At the moment that is WPF and MVVM.

Updated on May 13, 2020

Comments

  • ProfK
    ProfK about 4 years

    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.

  • MemeDeveloper
    MemeDeveloper over 12 years
    N.B. having played around a bit with trying to get TFS to SC empty folders... it seems you can't which is really annoying. e.g. I have SquishIt running and it needs a specific folder when the deployed version hits the server, so it has somewhere to place its runtime created combined css / js files. seems I need to check in a dummy file, or one of the existing files to have TFS recognise the folder, and include it in the deploy. Very silly. We shouldn't have to trick our source control like this really... :(
  • rob
    rob about 12 years
    thanks, that worked perfectly just remember to bind all the solutions and projects that you add, VS will prompt, click the solution/project and "bind"
  • toddmo
    toddmo over 11 years
    Just to clarify: Add Items to Folder is a button on the toolbar of the Source Control Explorer. I was unable to find it based on this answer and accidentally found it reading another article.
  • LeonZandman
    LeonZandman over 9 years
    That only works if the location you want to add the folder to is inside a solution. It is perfectly legal to have files/folders under source control that aren't part of a Visual Studio solution.
  • maxisam
    maxisam over 9 years
    @LeonZandman ah... It works in both cases, at least in my environment.(win7 + VS 2013)
  • LeonZandman
    LeonZandman over 9 years
    @maxisam Maybe we are talking about two different things? The Solution Explorer only shows stuff that's inside your Visual Studio solution. Therefore you can only drag/drop things into the solution it currently displays. The Source Control Explorer is a different window. It shows the complete TFS contents and can be used to add stuff to arbitrary locations. The answer to this question thread would be for him to use the Source Control Explorer. Your answer however talks about the Solution Explorer and I don't think that's correct.
  • maxisam
    maxisam over 9 years
    @LeonZandman I see, We were talking on different thing. However, this trick works on both cases. In Source Control Explorer, it will just pop up one more window asking you what files do you wanna add to source control.