In Visual Studio 2015 connected to a team project on TFS 2015, I can go to Team Viewer -> Pending Changes and I can see a list of files in my (local) workspace which are "adds" but have not yet been promoted to source control. These are listed in a hyperlink such as Detected: 121 add(s), 0 delete(s). When I click on this link a window is opened listing all of the added files where I can select all -> right click -> delete
How can this be done with tf.exe?
No such option in Tf Command-Line Utility Commands. The items you mentioned are Candidate Changes. If you add or remove a file outside Visual Studio, Visual Studio can detect the changes that you make and treat them as Candidate Changes. tf.exe can only detect the add/remove files inside Visual Studio.
You may try to use TFS API to achieve what you want, here is a blog should help you:
https://roadtoalm.com/2013/06/13/using-local-workspaces-promote-excluded-changes-with-tfs-2012-api/
Related
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.
So my team mate commited some code in TFS and he added some new references. However these would not want to download even if the checkbox is checked insite the nuget package settings. So I tried deleting all the references from the solution explorer. How can I get them back as well as whatever my team mate commited to TFS?
right click on solution>source control>get specific version to undo changes.
If that doesn't bring your deleted files, you need to go to:
Tools->Options->Source Control->Visual Studio Team Foundation, then check
"Show deleted items in the Source Control Explorer"
checkbox.
Go to source control where your deleted files where located right click>source control>get specific version
I have some 3rd party dlls checked into TFS
Our machines were renamed and now TFS believes they are checked out for edit by me on another machine.
I tried tf lock /lock:none contrib64/* /workspace:oldmachine;myusername but I get the error
TF10152: The item $/XXX/YYYY/contrib64/third_party.dll must remain
locked because its file type prevents multiple check-outs.
1, Is there any way around this ?
2, Is TFS really this bad or is it just me ?
3, Is the purpose of TFS to make us nostalgic for VSS?
ps It's a hosted version so I can't just get the admin to fix it.
Undoing the lock won't work on those files because they are binary, as binaries cannot be merged they must be locked if they are checked out.
As the machine the workspace resides on no longer exists (the machine has been renamed) the best thing to do is delete the workspace.
from a Visual Studio command prompt
tf workspace /delete oldmachine;myusername /collection:http://*tfsserver*:8080/tfs/*collection*
This will remove the workspace and undo all pending changes
If you don't want to delete the workspace, you can undo the change and unlock the file after that:
Using a Visual Studio developer command prompt:
tf undo "$/<server-path-to-file/folder>" /workspace:"<workspace>;<user>" /collection:<collection-url> /recursive
tf lock "$/<server-path-to-file/folder>" /lock:none /workspace:"<workspace>;<user>" /collection:<collection-url> /recursive
Files with .dll extension as well as other extensions like .exe, .doc, .docx, etc. are automatically locked because (as mentioned) here they cannot be merged.
If you want to disable the automatic lock and allow these files to go through gated check-in, follow the steps below:
Log in to your build server.
Open visual studio.
In team explorer, log into your team project.
Go to "Settings".
Under "Team Project Collection", select "Source Control".
Set "File Merging" property to "Disabled" for any file extension you don't want to be automatically locked.
Reference: https://blogs.msdn.microsoft.com/phkelley/2008/11/12/everything-you-ever-wanted-to-know-about-locks/
This worked for me.
I needed to change settings in 2 places:
At Visual Studio, team project window, Settings->Team Project Collection -> Source Control
Enable File Merging for the extension.
2) At Visual Studio, team project window, Settings->Team Project -> Source Control
Enable the multiple check-out box
VS2012 seems to remove the popup window for TFS check-ins that was in VS2010. It now seems to take over the team explorer tab in my sidebar, and buries the important things - like which files I've changed. Is there any way to return to a normal popup window for check-ins in VS2012?
For me, the best solution is based on iSid's answer: to add an external tool that pops up the old dialog.
You can do this from Visual Studio: TOOLS -> External Tools… -> Add, with the following values:
Title: Checkin (or any name that should be displayed in the menu)
Command: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\TF.exe (this is the default VS install location on Windows x64)
Arguments: checkin
Initial directory: $(SolutionDir)
Here is a screenshot:
You can invoke from TOOLS -> Checkin (or even assign a keyboard shortcut to Tools.ExternalCommand* as described here) and enjoy the old goodies with a new style:
Note that this won't work if a solution is not opened, because of the $(SolutionDir) variable. To workaround this, you can hard-code the path to your workspace instead.
Additionally, tf.exe can be invoked with 'shelve' argument, which will show the old-style shelving dialog.
Use tf checkin command from Visual Studio command prompt and you will get the same old checkin window.
While the Pending Changes window is merged within the Team Explorer, the Solution Explorer allows filtering by what is pending to be checked in. In addition Open Files filter could also be applied. When the Pending Changes filter is applied, all or some of the files could be selected and right clicked and then there is an option to do the check in. That command takes directly to the Team Explorer in Pending Changes view. See below...
Another method is to use the Productivity Power Tools. This extension adds Windows shell integration so you can perform most of your TFS commands directly from within Windows without even having Visual Studio open. The Power Tools uses the old style windows when used from within Windows shell.
I think the easiest solution is just docking the Team Explorer tab as tabbed document (using the right-click menu). That way it will be equivalent to the popup dialog.
Can anyone tell me how to revert (roll back) a checkin in TFS 2010?
You have two options for rolling back (reverting) a changeset in Team Foundation Server 2010 Version Control. First option is using the User Interface (if you have the latest version of the TFS 2010 Power Tools installed).
The other option is using the TFS 2010 version control command-line application:
tf.exe rollback
I have information about both approaches on my blog post.
For Team Foundation Server 2012, 2013, or Visual Studio Online, rollback is now built-in directly to Source Control Explorer and when you are opening a changeset's details in the Team Explorer Window. You do not need to install any release of the Power Tools for this functionality when using Visual Studio 2012 or later. There is a great MSDN article discussing details about rolling back a changeset now available here: http://msdn.microsoft.com/en-us/library/ms194956(v=vs.110).aspx
For 2010, use the rollback command from the command line. There is not integrated support in the IDE for this, as of yet.
Rollback command
Basically, the way that it works is that it creates an "anti-delta" to negate the impacted changeset. You can accomplish the same thing manually by doing a Get Specific Version, adding a space to the file so it looks like it changed, and checking it in. I still go the latter route to back out a change if I need to for a single file, as I find it quicker to do.
Without using power tools or command line:
ensure Tools->Options->Source Control->Visual Studio Team Foundation Server UNCHECK Get latest version of item on check out
View the history of project folder in Source Control Explorer and right click on the changeset to roll back to and choose Get This Version
Check out for edit on the project folder in the Source Control Explorer (this should keep your local version you just got from the history)
Check in pending changes on the project folder in the Source Control Explorer
if visual studio asks you to resolve conflicts, choose keep local and attempt check in of pending changes on the project folder in Source Control Explorer again
Rolling back changes for another user
If you are attempting to rollback changes for another user, make sure you get latest on the files you are attempting to rollback; otherwise you will see the error:
"No changes to roll back."
You can rollback a changeset (in TFS2010) through command line doing:
Open CMD or Visual Studio Command Prompt
Change directory to your workspace folder. Example: cd C:\myWorkspace
Run following tf command (where 123 is changeset number)
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe" rollback /changeset:123 /recursive
Go to Pending Changes window to check files marked with edit,rollback and do a Check In.
Note: you must use tf.exe full path even in Visual Studio Command Prompt to avoid "Unable to determine the workspace" error. More info here
Rollback reference (TFS 2010)
https://msdn.microsoft.com/en-us/library/dd380776(v=vs.100).aspx
right click file in Visual Studio and Source Control/View History
then select last changeset, right click and click Rollback
After rollback done, you should check in again.
There is no undo option in TFS (up untill 2008, I haven't used 2010 yet).
There are some command line power tools you can use to rollback changes that may help:
http://msdn.microsoft.com/en-us/library/ms194956%28VS.80%29.aspx
HTH