TFS - Find In Files - tfs

My team has just migrated from VSS to TFS 2013. On VSS, we would often search the entire database for the occurrence of some string (usually a table or procedure name) to find out everywhere it is used. This functionality is clearly not available in TFS.
I have seen some alternatives, none of which sound very viable in our environment. As a result, I started tinkering with creating an app (or extension) to do it directly from TFS. However, the only way I found to do it is to download and search each file one at a time (I also could not find a way to filter the return from GetItems with a list of file extensions), which is slow and undesired.
Is there a faster way, through the API, to search through the source files in a TFS server?

Microsoft has announced that they are working on this exact feature, and it should be coming to Visual Studio Online in Q1 2015, and to on-premise TFS sometime after that.
You can read about it at the bottom of this blog post:
http://blogs.msdn.com/b/bharry/archive/2014/11/12/news-from-connect.aspx
Also the estimated timeline is publicized here:
http://www.visualstudio.com/en-us/news/release-archive-vso.aspx

You can use TFS Administrators Toolkit, here is the description of search feature:
http://mskold.blogspot.se/2012/09/find-in-files-new-feature-of-tfs.html

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.

Can you export history from Visual Studio Online to another ALM system?

I’m beginning to consider moving an on-prem TFS 2012 installation to Visual Studio Online. So, one of the first things I started investigating was how we might export our content back out of VSO in the future if we ever decided we needed to. The more I’m looking, the less I’m finding. It seems there was a temporary time period when VSO first went GA that Microsoft offered that capability if you asked to have it done (http://www.visualstudio.com/en-us/news/2014-apr-3-vso.aspx). By implication, that would seem to mean that this isn’t something that is a planned feature of VSO.
Making a commitment to house all of my source and ALM data in a repository I’d effectively be barred from leaving doesn’t sound particularly appealing. Am I missing something, or does Microsoft really not have export capabilities on their VSO product roadmap? It would seem that this would be a show-stopper for many organizations from coming onto VSO, which is a perfect application to put into the cloud IMHO.
For code you can use Git. Even if you start with TFVC, you can use Git-TF. Clone with the --deep parameter to get the full history in a new Git repo, then push back to a new project (Git or TFVC).
For work items the TEAM tab in Microsoft Excel is a very capable export facility for work items, though you don't get links (other than parent child), or attachments.
In the original project, create a query that lists all your work items.
Open Excel, go to the TEAM tab and click 'New List', you should get the option to select your project and the query you just created.
In the Work Items tab select the 'Choose Columns' button and select all the columns you want to migrate.
If migrating to another TFS / VSO project, create that project, open another list in Excel connected to the new project.
Cut and paste all the work items from the original project list to the new project list (excluding the Id column).
Publish.
voilà.
You're right there's no good solution for this yet. However, if you're using Git as the source-control back-end (instead of TFVC), you can easily pull down the entire repo then push it up into any other source control server (non-VSO) with full history.
For TFVC source-control, or work items (or builds, test results, etc), things aren't so easy.
The answer is not black and white: with the TFS Client API you can connect to both platform and read/write as you please. It is not a trivial task, so someone has created tooling, like Brian says. Another option is using the open source TFS Integration Platform: it is complex but with some help you can do it.
What you really must consider and plan is the data model: moving from an ALM Platform to another is never trivial and the complexity lies in the difference of the underlying model and any customization you made.
As long as you do not customize you on-prem TFS, it is very doable, with a reasonable effort to move to VSO and back. In this context customize means: custom workitems fields, types or workflows, server-side plugins; shortly anything that requires code or schema change. Note that you can still customize builds as this is properly managed.
I expect to see more solutions arriving thanks to the new REST API, but it will take time before we see solid products.
So your original question has a positive answer (TFS on-prem -> VSO) using OpsHub, but know what you are doing and, as I write, it is practically a one way journey.

Not enough permission to change Bug Workflow

I am using TFS Service (on the cloud solution) and I would like to customize the bug states.
There are many resources explaining how to do that using TFS Power Tools, so I downloaded and installed it.
I am able to open the workflow, but I am not able to change anything because I get the following error message:
Failed to save the 'Bug' Work Item Type to the server. TF237113: You
don't have enough permission to complete the import operation
I am using an administrator user.
Is it possible to make this change on Visual Studio Online?
While you are correct that it is not possible to customise the process template on Visual Studio Online you do have a few options:
Kanban Columns - If you want to you can customise the Kanban columns so that you have 'meta states' that you can use. I know that it is not the same but it could get you there.
Go offline - Currently and for a limited time you can take your VSO account on-premises. The TFS team are holding the version of VSO in parity with TFS 2013 Update 2 so that folks can do this. Be aware of what you loose though. No frequent updates and you have to host your own servers...
Not sure if these options help but they are options...
Making more research I found the answer: it is not possible:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3654231-customize-process-template-on-visual-studio-online

Symbolic links in TFS 2010 Source Control?

As far as I know, Team Foundation Server 2010's source control (and prior versions) doesn't support linking (Symbolic links) of files.
Linking (per Visual SourceSafe) was the concept of providing one "hard" file in a folder, and then "linking" to it in other locations - exactly like file system hard links are designed.
Does anyone know if files can be linked at all? I realise it is not a good practice in general, but I have some scenarios where it makes sense.
According to an answer in this thread: Linking TFS source control folder from another TFS project it's not possible, but I can't find a definitive answer.
Closest thing I can find courtesy of Google is a thread on the MSDN forum but it's quite old (2006). I'm pretty much assuming that this is still the answer though (unless anyone knows differently)?
This thread is more recent (2010), about TFS 2008 and 2010:
TFS (2008 and 2010) do not have support for links. There is a server-side extension for TFS 2010 (ie. what VS2010 used for gated checkin) but this sounds like a client-side solution since the link must be converted to a file to be recognized by the client OM.
If you only work with the command line, how about a wrapper tool for some version control operations? For example, the check-in wrapper would convert links to a linktext file and add or replace the existing linktext file before doing the normal check-in. The check-out wrapper would check-out the corresponding linktext file. Note that there will be quite a bit of work since you'll have to wrap many commands.
There seems to be a work-around for this for Linux-based systems.
This page - Applying Unix Filesystem Attributes to Files under Version Control - describes how to use a .tpattributes file text file to store details about file attributes. The article applies to the Visual Studio 2010 edition.
The process is described here: How to work with symbolic link files under Linux/Unix and TFS?. It involves the use of both a .tpattributes file, and a 0-byte file representing the symlink.
There have been some reports of success for this, according to the comments on an updated request to Microsoft for this feature to be implemented in TFS 2015.
In Perforce, symlinks may just be checked-in without having to go through any of this.
It's not possible to make classical links, but it's possible to use branches for simmilar functionality. You can use a branch over folder to make something simmilar as were links. The only drawback is that you still work with branches, so it's necessary to do merges etc. See section "Source Code Sharing" of this document for detailed instructions.

Setup for Team Foundation and ClearCase with TFS Integration Tool

I want to do daily migration of TFS changes to a ClearCase system. I was going to try out TFS Integration tools but I can't get any of the toolset pieces to work. What are the requirements to run this app? I have VS 2010, TFS 2010 and Sharepoint 2010 installed. The assemblies it's trying to load don't seem to be present in VS2010 and I don't if it requires VS 2008 or not. Anyone ever had this running? I'm migrating from TFS to CC. Not the other way around.
Update:
I've been using this tool to sync TFS 2010 changes back into a UCM ClearCase implementation at the client. It has been going poorly. The tool should be clearly marked as Beta or even Alpha. A peek into the code reveal around 100 TODO's and "This needs to be fixed". I have spent a good deal of time trying to iron out some of the issues and have made progress. My suggestion is before using this tool on mission critical projects, spend at least 3-4 weeks evaluating it in your environment. When it works, it works pretty well with moving changes.
I don't know much about how to access TFS2010 elements, besides "check an individual project for pre & postbuild steps either by loading the project in visual studio or manually reading the project file".
If you need Sharepoint assembly, this technote describes the requirements.
And I don't think an automatic import utility exists (from TFS2010 to ClearCase 7.1.x), as this technote mentions:
Change request (RFE) RATLC01005874 had been submitted requesting a conversion utility to export source code from Microsoft Team Foundation Version Control (TFVC) to ClearCase;
however, the decision was made by Product Management to exclude the requested feature from future upgrades and releases due to the significant architectural changes required to implement the solution.
The right approach is to manage to list the content of relevant labels for a given scope, and make a clearfsimport into a ClearCase view, with a full label applied right after it.
You don't need TFS (server), VS or SharePoint installed. You will need a SQL server for the core platform. Then you will need the various assemblies for TFS, which you can get by installing the Team Explorer component (it's on the TFS install media).
We decided to go with the TFS Integration Platform. It allows us to sync TFS work items back into ClearCase when ever we want. It provides the level of integration we needed to keep the traceability. The TFS to CC integration is bleeding edge, but it works enough for what we need. (Syncing work items and user check ins.)

Resources