Modified TFS Destination path - tfs

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

Related

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.

TFS 2010 - The path E:\SSIS is already mapped in workspace PC-mypc01

I have a number of SSIS packages spread throughout TFS, e.g. \Imports\impSSIS01\\, \OtherPackages\Exports\expSSIS02\\, etc. Anytime I open up any of those, I want the working directory to be E:\SSIS\, e.g. E:\SSIS\impSSIS01\\*.\*, E:\SSIS\expSSIS01\\*.\* When I try to set up my workspaces like that though, I get the error:
The path E:\SSIS is already mapped in workspace PC-MYCP01
I don't care if it's already mapped. I know it's already mapped. I want it to be already mapped. Just let me map it.
(Also, does this mean no one else on my team could use E:\SSIS\? I hope not, it's a shared drive we all need to use.)
Have you tried removing all your mappings and then map the root of your Tfs collection to e:\ssis. That way getting latest on a sub folder will extract the contents to a folder relative to e:\ssis.
Download the free Team Foundation Sidekicks 2010. It provides a convenient way to delete and modify workspaces.

TFS: Removing leftover custom mappings after moving folders

I have a workspace where I want the repository root mapped to a particular folder (e.g., $/ mapped to D:\Home). This then picks up the default "natural" folder structure in the repository without having to map stuff manually.
There's a pair of subprojects that I had under the default TFS structure and were recently moved around under another folder. TFS helpfully remembers that those were pointed to a particular location on my hard drive, but what I need is for them to lose the (now) custom mapping and simply go back to picking up the default mapping location based on where their parent folder points to.
I can see an option to remap the folders, but no option to simply drop the custom mapping. IIRC Visual Source Safe had a way to do this -- to just stop mapping a folder in a custom way and return it to being mapped by default based on its parent folder. But I can't figure out if TFS can do that as well...
If it makes any difference, this is TFS2005 being used from VS2010.
EDIT
Here's an example to make this clearer. Say $/ was mapped originally to D:\Home. So $/Foo would map 'naturally' to D:\Home\Foo. $/Foo/Widget was also mapped naturally to D:\Home\Foo\Widget. Then Widget was moved from under $/Foo to $/Bar, but TFS is still telling me that the mapping is to D:\Home\Foo\Widget, when I want it to be D:\Home\Bar\Widget. I want to remove the custom mapping and let Widget be mapped to the 'natural' location under its parent folder, not point to the older location.
I think I understand what you are trying to do.
How did you move that widget? Did you use TeamExplore -> Source Control Explorer to move it? If not...
Open Source Control Explorer -> Go to your widget and right-click -> Move (Option is directly under Brancing and Merging)
You will see a dialog with a From and To box. Browse to the new location on your HDD and move the widget.
In this way, TFS will pickup the new location correctly and it will be naturally mapped again. Anytime you want to move Widget (where widget = project or folder etc) from $/something to another $/something use the Move tool. Checkin in the change and you should be good to go.
When you create a Working Folder within Team Foundation Server, you specify the server path you want to map, the local path on your computer, and the recursion level. For folders beneath those paths, the server determines the local paths based on those mappings (and recursion level) but it does not actually create any new mappings or any long-term state, the local paths will be recalculated. (In other words, there's nothing to clean up after a rename.)
If a folder rename is checked in on the server, to update this on your local workspace, you simply need to do a get on the parent folder. For example, if $/Foo is renamed to $/Bar, you should do a get on $/ in order to get that rename locally.
Nice and easy. Everytime you associate a file by checking it into TFS, TFS remembers the source path by creating a reference to it in the list folders mapped to your workspaces.
To clean this up, open Visual Studio, Connect to TFS. Go to File menu, chose Workspaces. You will see all the mappings that visual studio has managed to create for you. Feel free to clock or delete the ones you are not interested in. http://msdn.microsoft.com/en-us/library/ms181386.aspx
HTH.
Cheers, Tarun

is it possible to get a file from TFS into a local unmapped folder?

Looking at the docs for tf get I think the answer is no. Still, I could be wrong. I'd like to have a file that's mapped to C:\Projects\MyProject\SQL\myScript.sql. I'd then like to run a batch file that gets several files (including that one) from the repository, puts them into a local temp folder, runs them, then deletes them.
It's the first part that's the issue: I think that TFS won't let you get files into a folder without remapping the source folder to point to that folder first.
So I suppose I need to remap the remote folder to point to a new local folder (C:\Temp\Scripts for instance) then get the files, then map the folder back to where it was. Seems like an extra step that helps nothing.
Have a look at tf view to see if that does what you need. Otherwise, the usual pattern for doing stuff similar to this is to create a new workspace using the tf workspace command, map the folder, do a get then destroy the workspace.
Even better for you would probably to use the .NET API VersionControlServer.DownloadFile() - especially if you are doing his from a powershell script rather than a simple batch file.

Resources