Add solution to different TFS team project - tfs

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.

Related

Adding project from VS2013 to AzureDevOps

Im using VS 2013 (CE).
Windows Server 2012 with a local install of Azure DevOps.
I can connect to the repository via the URL
http://example.local/DefaultCollection
Under defaultCollection i have another few test projects i.e.
/DefaultCollection/A-Project,
/DefaultCollection/B-Project.
For this example i will user C-Project which im trying to add to source control.
All im trying to do is add a project to this source control but i am experiencing issues that i would have thought shouldnt exist:
In VS2013, I add a new solution. I right click the project and select "Add solution to source control". Immediately it selects the project A-Project with the path /DefaultCollection/A-Project/C-Project. I dont want this as it resides inside another project.
From the web portal i create a new project and select Team Foundation Server (not Git as the examples online i have seen all select Git). In VS i create a brand new project and then attempt the same as 1 above but it tells me that i already have a project with this name under source control. I expand A-Project and i see it listed and undo any changes but it still doesnt add as i get some form of error.
Other problems range from the local version not mapped to, existing file exists/under source control to other errors.
What is the correct process to add a project to Azure Devops when using Visual Studio 2013 CE?
The default steps are described here: Set up Team Foundation Version Control on your dev machine.
You have to:
Create a workspace from the target project.
Copy your project into the locally mapped folder.
Add your project to the source control.
As workaround:
Create workspace from the target project: Create and work with workspaces
Copy your project into the locally mapped folder.
Add your project to the source control by: Manually add files to version control
Open the project and fix source control bindings:
Useful document: Add files to the server

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.

How to add an existing project to TFS

I have a solution with 6 projects already in TFS. Each project is in its own folder.
I right clicked the solution and added a new project, so the solution XML knows about my new project.
I checked in the solution file, but the newly added project is not listed in the source control explorer, presumably because I never checked in the files.
My question is how can I check in the project and ensure that the new project files go into its own folder?
If I right click in the root of the solution and select the new project files the "Destination source control folder" is set to the root - do I need to first create a folder in TFS which matches the name of my project folder? That seems backwards.
Sounds the solution is not in source control when you add the new project. Normally the new project will be created in the solution root folder and the files will be added in source control automatically if the solution has already been in source control.
So, please open the solution root folder with Windows Explorer to check if the new project exists in the workspace (solution root folder). If the project exists, then follow below steps to add the existing project in source control.
Navigate to solution root in Source Control Explorer
Right click in Source Control Explorer and select Add items to
folder
Select the Project folder you have created, then Next
Select items to add or Excluded, then Finish
Check in the changes

I made a mistake in my source control mapping. How do I correct it?

I created a team project, say ProjectA
When I mapped it to my local folder, I found that the root server folder: ProjectA folder is not mapped. However the ProjectA folder within that IS mapped to the project. This is a problem as the BuildProcessTemplate is not included in source control and I cannot build my application.
How do I remove the mappings and start again?
On the source control explorer window in visual studio there is a drop down near the top for workspaces. When you originally mapped that folder, it created a workspace for you. If you want to change the mappings, it can be done by clicking the drop down and selecting the Workspaces... option. You can select your workspace and then click Edit.. to change mappings. You can also delete your current workspace and create a new one if you feel so inclined.

How do I add a new solution to my team project?

We have a team project in TFS 2010. This team project is used as a container for a few smaller, related projects in order to share bugs, work items, etc. My question, how do I add a new VS solution to this team project?
I created the new solution in my local working folder. The team project is already created on the server. When I go into the Source Control Explorer and try to add the new solution to the project, I can’t add the new solution because I don’t have a destination folder mapped. I can’t map the destination folder because I can’t figure out how to add a new folder to the server project for the new solution. Caught in what appears to be some wicked circular logic… help!?!
To add a new solution from you local files to TFS you could:
In the solution explorer right click on the solution and select 'Add Solution to Source Control'
Then you can right click and select check in.
Then the entire solution will be added to your team project in TFS.

Resources