TFS overlay branch mappings - tfs

Can Microsoft's Team Foundation overlay multiple branches to a single source branch?
I'm trying to map 3 locations from the depot to 1 location in my workspace, like below:
//workspace/Project/Source/... //depot/Project/Source/...
+//workspace/Project/Source/... //depot/branch1/Source/...
+//workspace/Project/Source/... //depot/branch2/Source/...
There is a single source directory and im trying to overlay two branches one with fixes another with pending changes.
The version is TFS 2017

One workspace does not allow the same TFS folder to be mapped to more than one local directory. We could also not map multiple server branches to the same local folder/location which already be mapped.
If you do this it will not overlay the files, instead it will pop up the error message something like below screenshot:
You have to either merge changes in the server first and than get latest version for your local files or keep local folder with the different subfolders(the same structure) as server side.

Related

Modified TFS Destination path

I am working with Team Foundation Server and I'm trying to fetch content from the server into my local folders.
so basically I'm using: tf get "companyName" /recursive /force /noprompt in the command prompt and everything is working smoothly and it gets stored under
C:\Users\myFolders\Escrow\XYZCompany\TFS
I'm using a program class and the path gets called from an app.config (XML) file into my visual studio class.
Is there a way to change the final path? I need to segregate the customers into subfolders so C:\Users\myFolders\Escrow\XYZCompany\TFS\CompanyOne or something similar, can this be done or altered? if I change the path I always get a message that everything is up to date and if I don't include the TFS folder, it gets created automatically whenever I run my command.
Thanks in advance for the help
This behavior is controlled by the workspaces you have mapped. A workspace represents the mapping between a location in source control and a folder on your PC.
It's not entirely clear whether your intent is to map the same source control location to multiple folders on your PC. You can't do that. In that case, it sounds like you need to adopt a branching strategy to allow for isolation of work between different customers.
No, you can't map the same repository to the subfolders of one folder. You could either:
Create multiple workspaces. Each customer has a workspace and map to different path.
Use branches. In general, you should map your entire team project to a single local folder under for example c:\Users\YourName\Source\Workspaces\, If you create branches for each customer, then you could map branches to c:\Users\YourName\Source\Workspaces\Main or c:\Users\YourName\Source\Workspaces\branch

How to identify files updated outside of TFS

We have a nopCommerce website of a client's that one of their IT guys was modifying views directly on the web server. They now want to do more extensive changes so we want to put the baseline NopCom code in TFS.
Then, ideally, we'd like to be able to identify all the views that were changed directly on the web server and have those changed views be recognize as changes in TFS source control to check-in.
Is there anyway to do this in Visual Studio/TFS in batch? i.e. it would be great to do a check-in locally so all the base code of NopCom was checked in to TFS, then download the website files and overwrite them in the local workspace and have TFS recursively do a diff and determine if any new files were added or existing ones changed and mark those for check-in.... I know...I'm probably dreaming, but any other smart workarounds appreciated as well, assuming this won't work.
TFS does what you want. To set up Team Foundation Version Control (TFVC) on your dev machine, you just need to create a workspace and then add your code. Check link: https://www.visualstudio.com/en-us/docs/tfvc/set-up-team-foundation-version-control-your-dev-machine
When your codebase is under version control, you can develop your app, create and open files in Solution Explorer and write your code, while version control does other work for you. When you check files in and out, it keeps track of your changes and creates a history of your project.
You can use the Diff window to clearly see the difference by comparing folders or files. You can compare server folders and local folders to each other, and view the differences between the contents of each folder. You can compare two server files, two local files, or a server file against a local file and view the differences between the files.
You can get more details about TFVC from website below: https://www.visualstudio.com/en-us/docs/tfvc/overview

TFS Mapping lost local code

I have a solution on TFS "Project One".
"Project One" was copied via external to another device of mine and i needed to map the solution on the new device to source control. Once i mapped the project, it replaced all the source that was local with whatever was last on TFS for the project. Any way i can get my local source back or is it gone forever?
I had not done any backups on the local code as i didn't think it would delete my current source. In fact i thought it would as me to do a merge.
I had a look at this link after my code had been replaced
Unfortunately you've lost the changes as TFS has overwritten the local files. You set up the workspace after making the changes so TFS didn't know anything about them in order to merge.
If you created any additional files that weren't under source control then they should still exist locally, so maybe you haven't lost everything
In future, if you setup the workspace first then you can obviously make changes to the files and TFS will know about it.
Alternatively, map the workspace to a different local folder and then copy in your changes. If you are using a local workspace then TFS will generate the pending changes for you.

Working with TFS source control folders without map to local folder

I have many projects in my Source Control folder, can I work from the server repository without mapping a local folder?
No, but you can configure you local workspace to only map to the folders you are interested in. You can also create more that one workspace.
For example:
Create workspace called "Project A"
Create a Mapping from $/TeamProject/Stuff/MoreStuff/ProjectA to C:\Code\ProjectA
Repeat for other projects you are interested in.
You can now select a workspace to use in Source Control Explorer (and in Pending Changes). When you do a "Get Latest" on your workspace you will only get files you have mapped.

How to have two repository paths mapped to one local path in TFS 2010

we have 2 branches of code in tfs 2010 such as enhancement and support
Most of the developers work on enhancement as well as support.
Now, We want to create two different work spaces and map it to one local folder as we have all our virtual directories mapped to that local folder and dll registered from that location.
However, TFS does not allow this!! So what is the alternative? Also
mapping to two different local folders will occupy more spaces on each individual developer's machine.
This is not supported. As Stuart mentioned in his question - TFS is not able to decide where to do check-in, if you try to check-in your changes on one file mapped from two branches.

Resources