Copy some folders from one TFS project into the other - tfs

I have a single TFS server with 2 different team projects - Project 1 and project 2. Project 2 is completely empty. Now, I want to copy some ASP.NET project 1 folders into project 2. How do I do that?

You can rightclick on the team project in Source Control and then select Branch (2008) or Branching and Merging -> Branch (2010).
In the dialog you see specify that TP2 is the target for your branch.

Check out project 1 and project 2, on the local system copy the folders you wish to copy from p1 to p2. From the source control explorer add the copied folders to source control. Check in changes.
AFAIK there is no way to make "links" to existing files or folders in TFS.

Related

TFS - Branching

I am doing to for the first time so I want to use Release isolation strategy for our project using TFVC. I went over documentation on how to do that but I was unable to branch out our projects. We have two projects which are dependent on each other and structure of those projects looks like this:
Project 1
folder 1
folder 2
folder 3
I tried to convert project itself to branch and then branching it out but it gives me an error saying TF10175: ... Team project does not exist. Then I tried to create one main folder inside the project and convert that folder into branch and then branch it out but reorganizing folders causing build issues. Do you have any advice how I could branch my projects out and why am I getting team project does not exist issue. Do I need to create new project in TFS called XYZ-branch?

Can I check in code to another project in TFS 2013?

I'm writing code in a TFS 2013 Project. I'd like to check it into a different Project on the same server. Can I do this? Thanks
You can not directly check in the code to another project, you need to add the code file to another project first for source control, then check in the code changes.
In visual studio Team Explorer:
Connect To TFS project 1, configure the workspace and map source
code to local folder1. Open the folder1 in windows explorer.
Connect To project 2, configure the workspace and map source code to
local folder2. Open the folder2 in windows explorer.
Copy the code file which you want to check into another project (eg,
project 2 here ) from folder1 to folder2, then the system
will detected the new added files under Pending Changes >
Excluded changes.
Click the Detected link to Promote the new added files.
Check in the files to Project 2
Refer to these articles for more information : Add files to the server
and Check in your work to the team's codebase
UPDATE:
You can link to the WI in the same collection, but cannot link to the WI which in another collection.
That means, if the team projects are in the same collection, then you can link the WI (associate with the changeset) which belongs to another project directly.

Moving a sub folder/ area path in tfs 2015

One of my team's created a new folder under a team project and using it as a separate project in tfs 2015.
Is it possible to move that sub folder project to a new project in the same collection?.
Thanks in advance!.
You can use tf rename command to move the path of a file or folder without losing the source control history.
tf rename "$/PROJECT/Sub folder/*.*" "$/NEW PROJECT/XX/"
Note: The results of this command are not reflected in the Team Foundation version control server until you perform a check-in
operation.
Required Permissions
To use the rename command, you have the Check out permission set to
Allow.

Add solution to different TFS team project

I've accidentally added my solution to wrong Team project on TFS, I've gone to File/Source Control/Advanced/Change source control, I've selected all my projects and unbinded them, went to solution, and after right click I've chosen Add Solution To Source Control, but pop-up appeared saying:
The item 'ProjectName.sln' is already under source control at the selected location.
If you are trying to rebind a project that you have already added to source control
outside Microsoft Visual Studio, you should use the Change Source Control command. If you are
adding this project for the first time, you should either choose a different server folder for the project or move the
existing project to a different server folder.
I've tried to bind project to new Team project, but when I tried to check in, not whole project was checked but only changes added since I've accidentally added it to wrong Team project.
To sum up how can now I add my project to TFS source control ?
You need to unbind it, then manually move the files into a local folder that is mapped to the correct team project. Then try doing the Add Solution to Source Control.
Each team project will be mapped to a different folder in your local workspace. If your files are under the folder for project A (which I assume they are if you've already added it to that team project), then you need to move them to a folder under Project B before trying to bind to Project B.

Is there a way to start a branch (based on a label) in the root of a team project?

I'm in the following situation with TFS 2010:
I have a team project (with 2 sub-folders of source code).
The team project has no branches but has been labelled in the past.
I need to create a branch in the root of the team project, based on a specific (and historic) label.
I have tried this method (all in Source Control Explorer):
Right-click team project and go to Branch...
Change Target to $/MyTeamProject/NewBranchName
Choose appropriate label.
Uncheck "Convert source and target folders to branches".
When I click OK I receive this error:
The target item $/MyTeamProject/NewBranchName cannot be under the
source item $/MyTeamProject.
Any ideas?
PS. I was able to branch the label into a different team project, but that doesn't solve my problem.
My guess is that the item $/MyTeamProject is included in your label, then TFS can't create a branch under that path.
So edit the label and remove the $/MyTeamProject path and try again.
EDIT :
You can only remove a folder using the TFS Sidekicks.
The problem is that you are trying to create a branch under the root of the branch you are branching from. That is, by right-clicking on the team project and selecting branch, you cannot create a branch under that team project.
Instead, try the branch operation from the folders. That will allow you to place them under the team project. If you want them to have a single common root, you will likely need to branch them separately into a subfolder under the team project.

Resources