Does any tool exist to help Sync a directory with TFS? - tfs

When using TFS with a tool outside of Visual Studio (Specifially ORMS), modifications to the project file to include a new file will not cause the file to be added to source control.
Does anything exist that could potentially say "Warning: You are about to check in change to a project file which include a file which is not versioned"

In addition to Martin's answer, the latest release of TFS Power Toys includes:
"Windows Shell Extension (NEW!)
Allows core version control operations within Windows Explorer without using Team Explorer."
So you may just be able to commit those new files without having to fire up Team Explorer or use an MSSCCI compliant source control client.

Not quite, however you might want to download the TFS Power Tools and check out the command line utility tfpt.exe.
The "tfpt online" and "tfpt treeclean" might be most useful to you when working outside of an integrated TFS client. tfpt online will look for files in your local directory that are not under version control, treeclean will show you files in your local directory that are not under version control so that you can remove then if they are not required.
Good luck,
Martin.

One gotcha I've found using tfpt online is that it doesn't always pick up changes unless you use the /diff switch. That one caused us all kinds of headaches with our automated build until I realised what was happening!

Related

TFS not tracking changes if items added manually and not included into vs2015 solution

I've added a folder with asp.net core project which isn't supported by Visual Studio 2015 (which is used for everything else) and thus not included to the general solution.
To have those files in source control I had to manually add them using "add items to folder" command in source explorer. So they are checked-in but tfs not tracking changes for them anymore although there are differences that are shown if compare to the latest folder on the server:
How do I make TFS track them and show pending changes for edited files?
According to your description, looks like these files are all out side of Visual Studio.
Not sure if you are using server workspace or local workspace.
When adding or editing the workspace you click Advanced >> . There is a setting of Location: Local/Server.
For local workspace, when your script or anything else changes files outside Visual Studio, your workspace detects the changes automatically.
It also detects adds or deletes but you have to include them to your Pending Changes manually with the link under Excluded Changes.
For server workspace, you could choose to use Reconcile command. See https://stackoverflow.com/a/22860674/932282 for a complete answer.
Besides, you could also take a look at other solutions in below similar question:
How to have TFS 2010 detect changes done to files outside of Visual Studio?
Force TFS to detect changes
I think you just added them to source explorer and not to the solution, as you said. In this case, there is no editor application (even your VS) that is responsible for doing the check-out operation because they are not aware of TFS. On the other side, TFS can detect that changes have happened to the files but can not track them.
If you do not activate the "Get the latest version before check-out" option in your team project, then you can go to the source control and check-out those files manually and then check-in them manually again when your work with them is done.
Please before doing this, take a backup of your source code for caution.

TFS - Versioning file in a drop folder

We currently use TFS 2010 for controlling some of our .NET projects.
I'd like to know whether it's possible to provide some kind of versioning within TFS for a specific folder on a network share for example.
The idea being is to control release packages (zips) for every release we do. As this bit is done by some other person (not technical and he doesn't use Visual Studio or any tech tool), it'd be great to streamline the process of versioning the zip files for every release.
Technically speaking:
We've setup this folder \servername\releasezips and every time I drop a file named release.zip, it would automatically commit (push) this file to the TFS server (no comments needed) and furthermore, once the file contents change (meaning that someone dropped another version of the file in there), the system would again push the file to TFS, but with a following version.
Is this possible somehow? I've seen somewhere that I could programatically have some extra control over TFS, using REST API.
Thanks in advance!
Thanks for your tips, Daniel and PatrickLu-MSFT.
As I said, I did want something straighforward, some kind of control similar to what box.com provides, where you associate a local folder on your machine with the cloud. So, once you drop files in the local folder, the small box client synchronizes it along with the cloud. If access the box.com, I can see the different versions of that specific file.
So what I did was, I've created a small .NET app to monitor the folder and any new files dropped in there would get checked in to our TFS server, by using the tf command line (of course ignoring work items or comments).
So, progamatically within the .NET app, it builds up the tf required commands for processing and versioning the recently dropped files and therefore, executes them.
By the way, I could have used the Team Foundation API in order to do the same job, but it would demand way more effort.
Cheers
According to your description, you want to commit/check in files during the build/release pipeline.
It's not a recommend way to check-in generated build files and modify source code during a build pipeline. If you really want to do this, you could edit the build workspace files and use tf commands in custom activity and call the powershell eq:
cd $env:BUILD_SOURCESDIRECTORY
$TFFile = Get-Item "C:\Program Files (x86)\Microsoft Visual Studio 1x.0\Common7\IDE\TF.exe"
$tfOutput = [string]( & $TFFile.FullName checkin /noprompt /override:"***NO_CI*** New version is $newVersion." /comment:"***NO_CI*** New version is $newVersion." 2>&1)
Another way is installing TFS Power Tool and use the Windows PowerShell Cmdlets to check in the files. Refer to this link for more details: PowerShell and TFS: The Basics and Beyond
For version the dropped files, you could take a look this similar question: TFS Build Copy to Versioned Folder
Basically, you have to customize build definition with custom activity and based on build.buildnumber variable to generate/create .zip file.

tfs 2010 does not sense file change that open from outside of project

Is it possible that set a configuration that TFS 2010 sense file change from outside of project? Consider I open a *.cs file with note pad and then change it's content and when open the project TFS 2010 mark it as checked out?
thanks
As leppie said TFS dont get the changes alone (without VS).
But if you often work without VS you can install the Team Foundation Server Power Tools August 2011.
After installing you have some extended entries in the contextmenu of the windows explorer
(on the folders/paths which have a workspace mapping definied).
Looks like
In addition to what other folks here have mentioned, you can do
tf edit [filename]
from a command prompt http://msdn.microsoft.com/en-us/library/z51z7zy0.aspx
Also, in order to change a file you will need to attrib -R to make it writable. If you do that, you can change as many files as you want and then with one command, pend edits to all writable files using the power tools K.Hoffman mentioned. To do that, run:
tfpt online
A good writeup here
http://blogs.microsoft.co.il/blogs/shair/archive/2008/09/03/using-tfpt-command-line-tool.aspx
Online Command
Use the online command to create pending edits on
writable files that do not have pending edits.
Example: tfpt [/deletes] [/adds] [/diff] [/noprompt [/preview]
[/purge]] [/exclude:filespec1,filespec2,...] [filespec...]
[/recursive]
If you checkout the file after editing in notepad, the changes gets picked up.
I dont think the changes will be picked up without a checkout though.

TFS source control without Visual Studio?

Is it possible to use TFS source control without Visual Studio? I have to put some files in some source control, those files are stored in a folder in some server, that is something developed in Oracle forms. I just need to add those files in some source control and I'd like to use TFS for that. Any tips or tools could we use for this?
TFS is likely to be overkill for a few files in a single folder, but if the TFS infrastructure is already in place then it will work.
You will need Team Explorer (or, on non-Windows) Team Explorer Everywhere installed to give you the client tools. But you can perform all source code operations with the tf.exe command line (or equivalent from Team Explorer Everywhere).
Team Foundation Server Power Tools has Windows Shell Extensions that provides integration
with Windows Explorer and the common file dialogs. With this integration, you can perform many source control operations without having to run Visual Studio or a Team Foundation command-line tool.
see this answer but you will need to make sure you have tfs server running as well to connect to. Would it not be simpler to use git/mercurial/svn...{any other free source control system}?
I am one of the lovers of TFS, but I think in your case if you don't need to use Team Explorer or Team Explorer Everywhere (which will need command line used) for none windows I suggest to use SVN sub version (VisualSVN Server) it's open source and it has integrated OS shell (TortoiseSVN ) right click menu which will be easy than using command line
Vlad: That is true, but this important: I have used the "Shell Extensions" for a while only to realize that it does create problems. First of all, the "Shell Extensions" does not report errors during a check-in; it only unexpectedly stops, and the window closes.
Also, the reason I am looking for an external "Source Control Explorer" is that if you delete any file from Window Explorer that was under Source Control by TFS, the Check-In procedure will fail saying that there is a file missing. The correct way to safely delete a file is to do it through "Source Control Explorer"; the check-in then works. Usually not a problem, unless, like me, you have a Java project and have no integration between NetBeans & TFS.

TFS out of sync between local and remote - how to "re-sync"?

I have a Project on CodePlex which is using TFS and I am using the TFS Plugin for Visual Studio. Now I have copied this project and worked on another PC without TFS and done some refactoring. Foolishly, I have then just used copy/paste and manual text editing to merge my changes, expecting that TFS just picks up the changes.
Apparantly, that is not the case.
Here is a screenshot of my local directory:
My Local TFS http://img259.imageshack.us/img259/2897/tfslocal.jpg
Notice how some files are missing the lock symbol - those are missing. If you look at the current TFS Tree on Codeplex, there are some files which do not exist locally anymore, i.e. WikiPlexExtensions.cs in the main folder.
Is there any way to easily tell TFS to compare my local to the remote repository and pick up the changes? I could re-add the local files using "Exclude from local project" and re-adding them, and I could create the "deleted" files as empty files just to delete them, but if I can avoid the manual messing around that would be good as well :)
The easiest way is to exploit VS 2008's "online" feature. Basically you want to set your solution offline, then bring it online while connected to the proper Codeplex server. TFS should figure out the rest.
Feature overview: http://msdn.microsoft.com/en-us/teamsystem/bb898913.aspx
Tweaking the settings by hand: http://blogs.msdn.com/benryan/archive/2008/07/09/using-tfs-2008-power-tools-to-modify-server-s-offline-state.aspx
To compare local and server folders, you can check out TFS Power Tool. After installing it, you can bring up the source control explorer, right click on the server folder and then select 'Compare'. Folder difference window will display the differences. You can also right click on the differences to see available commands such as 'Get Latest' to update your local folder for example. Check out Bryan Harry's blog post on the power tool
I don't think there is an easy fix... What I've done in the past is back up those files that I have edited, then do a "Get Latest Version..." for the files I edited. This should change the files back to being read-only etc... Now, check out the files the regular way and paste the backups you had into the checked out files. Obviously this really only works when there are a couple of files you have edited.
TFS (in Visual Studio) has a "Reconcile" command for this, see Microsoft documentation, or this answer with steps.
BTW: This command may not haven been existing at time of original question, but this question came first when I was searching.

Resources