TFS web portal: Possible to link/URI directly to line number in file? - tfs

I would like to send my coworkers a link directly to a line number in a file in our TFS repo. Is this possible? If so, how? We are using TFS 2015.
Currently, the best way I have found is to link to the file like so:
http[s]://{TFS-SERVER}[:{PORT}]/tfs/{PROJECT-COLLECTION}/_versionControl#path={PATH-TO-FILE}
Then, Ctrl+G to manually enter the line number. Before I dig through the JavaScript to find how Ctrl+G works, I am hoping someone can help me out.
I have tried variations on this theme, but without sucecss:
http[s]://{TFS-SERVER}[:{PORT}]/tfs/{PROJECT-COLLECTION}/_versionControl#path={PATH-TO-FILE}#line={LINE}
P.S. My issue is similar to this issue but rather than for Visual Studio, I am looking for a link via the TFS web portal.

Once you select a piece of code in VSO code editor, it is possible to copy a link to that section (see picture below). It looks like TFS has pretty similar url structure, maybe it will work.
Generated link structure
https://{PROJECT_URL}/_versionControl?path={FILE_PATH}&line={SELECTION_START_LINE}&lineEnd={SELECTION_END_LINE}&lineStartColumn={SELECTION_START_COLUMN}&lineEndColumn={SELECTION_END_COLUMN}

Just heard from a guy inside of Microsoft that adding &line=5should work. My local tests show it only works for Visual Studio team Services and doesn't work on TFS 2015 update 2. You'll probably have to wait until update 3 for this feature to hit TFS.
In the mean time, the JavaScript simply looks for a div with the right linenumber attribute:
<div linenumber="5">...</div>

Related

TFS Visual Studio 2017: Search for a file by name in source control

Our application code is spread over many dozens of folders in a nested hierarchy, and we have several hundred files making up the application.
So I wanted to know if there is a way to search for files by their name in the Visual Studio 2017 version of TFS ?
I spotted Q & A as per:
TFS: Search for a file by name in source control
but this answer seems no longer applicable for TFS and Visual Studio 2017.
I can, of course use tools outside of TFS (like the "Search Everything" app) and then navigate to the same folder and file in TFS.
I just felt that surely there must be a way of doing this file search within TFS ?
I have tried the search option in Team Explorer but I'm not sure how to use this ... not sure if this works ?
i.e.
There should be a search bar at the top of the TFS site that looks something like this you can enter all sorts of filter like those in the picture. Or you can search in files but that will only look at what you have checked out at the moment and not all over TFS. If you don't see the Search bar, it might be because your TFS Administrator did not install the search extension. You might want to contact him/her.
There is not any out of box feature to do this in Visual Studio 2017/Team Explorer2017 directly. If you want to search folders/files by name:
For TFS 2017, you can use Code Search if it's been configured by
your TFS admin. This is through web portal, more details please refer
this doc-- Search your code
For earlier TFS versions, you can create a local workspace and "get"
that specific version locally. Then use the built in search in your
OS (such as Windows file explorer) to find what you are looking for.
Hope this helps.

The Application Data folder for Visual Studio could not be created in jenkins

The Application Data folder for Visual Studio could not be created, this is the problem showing in my Jenkins. Before it works, all of sudden it is not working now after restarting the machine. I tried all the ways given in on-line and given in the below document too.
http://saurabharorablog.blogspot.ca/2012/06/solution-application-data-folder-for.html
Could anyone help me. Thanks in advance.
We solved this issue by simply running Visual Studio as an Administrator. This created the necessary folders and we were able to use it normally n all scenarios after that, including in Jenkins.
Key is: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
Entry inside this is ‘AppData’ which had the value %APPDATA%.
Then I changed it to this value %USERPROFILE%\AppData\Roaming
Then all the applications started working as usual. I wish any of you who find similar error message could use this solution to fix it.
[NOTE: The following link is broken from the US. Perhaps other locations as well. It should not be clicked as the site it reaches does not appear safe.]
Ref:http://tutewall[do not use]com/application-data-folder-for-visual-studio-could-not-be-created/

Paste screenshot into TFS 2010 Web access for bugs

Is there anyway to automatically paste screenshots into TFS 2010 Web access for bugs? I don't want to have to save the screenshots into files and then add them as an attachment. This takes a while to do this. I just want to quickly add them to the bug.
I don't think you can.
See this similar (possibly not identical) question on MSDN forums:
http://social.msdn.microsoft.com/Forums/en-US/tfsgeneral/thread/fe8b80c9-8fbd-4d6c-bc65-80d75dd3409b/
In response to:
Now, when adding the task into TFS 2010 , I can use the cupboard to “copy/Paste” from OneNote to TFS. But then the image is stored as a link to my local machine and not stored in TFS server.
The answer was (repeatedly stated):
As I said in my previous reply, we should to add the images as attachment into Work Items. Open Work Item in VS, click Attachments tab, then click Add to browse your images, the images will store in TFS Server.
Or, DIY and write an application
TFS exposes an API that you could use to create your own tool, rather than using their web access. See this question for how to implement that particular piece (adding attachments):
Upload a file using TFS Client APIs
In Visual Studio 2010 you can go to the Attachments Tab and paste your screenshot using CTRL-V.
An attachment called 'screenshot.png' will automatically be created.

How to keep links when moving work items (task, bug) between projects in TFS 2010?

Our situation:
In TFS 2010 + VS 2010 environment, we need to move source code and work items from old project to new project (new project is just for renaming and restructuring purposes, they all under one project collection).
We used TF.exe command line utility moved source code, it's good and carried history and links (changeset links to original bugs/tasks). We are happy about it.
Trouble appears when We tried to use TFS integration tool (MS recommendation) to move work items, it only carries forward attachments but no links. We need those links to link to our changeset. it's very important to us.
As I dig deeper, I know this "move" is not "real move" but creating new ID and copy the old information. Just wonder is there a way to do the move and still keep our links in bugs and tasks.
Thanks a lot
I got the following link from Link.
Have you looked at Hemi - Hemi is a tool that helps you move work items from one team project to another in Team Foundation Server.?
I think this is TF2008 - so you may be able to update the source to VS2010

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