Quickstart: Search the code base of a public project

Azure DevOps Services - Public Projects

In this quickstart, you learn how to search the code base of a public projects. With code search, you can locate specific types of code and easily narrow or widen your search.

To start your search, choose Repos > Files or other page under Repos, enter a keyword or phrase in the search box, and press Enter or choose the start search icon start search icon.

Code Search box, new navigation

View and work with search results

  1. The search page shows a list of the matching code files. The selected file has all instances of the search string highlighted. If you see a list of work items, ensure that Code is selected in the top left.

    Code search results example

  2. Assemble more complex search strings using the operators and functions listed in the drop-down list. Select the filter function or code type you want to include in your search string, and then enter the criteria value.

    Search from the title bar

    • You can find all instances of "ToDo" comments in your code simply by selecting comment: and typing todo.

    • You can search in specific locations, such as within a particular path, by using a search string such as Driver path:MyShuttle/Server.

    • You can search for files by name, such as Driver file:GreenCabs.cs, or just by file extension. For example, the search string error ext:resx could be useful when you want to review all error strings in your code. But even if your plain text search string, without specific file type functions, matches part of a filename, the file appears in the list of found files.

    • You can combine two or more words by using Boolean operators; for example, validate OR release.

    • You can find an exact match to a set of words by enclosing your search terms in double-quotes. For example, "Client not found".

    • You can use the code type search functions with files written in C#, C, C++, Java, and Visual Basic.NET.

  1. Narrow your search to a specific repo, branch, file path, or code type by selecting from the drop-down lists at the top of the page.

    Use drop-down lists to narrow your search

  2. Use the tabs in the results page to view the History of the file or to Compare versions of the file. Choose Blame to view the last commit, person, and date to modify the file.

    Use tabs to view history and compare files

    Open the search results in a new browser tab from either search box by pressing Ctrl + Enter or by holding Ctrl and clicking the start search icon icon. In Google Chrome, press Ctrl + Shift + Enter to switch the focus to the new browser tab.

  3. Choose the filename link at the top of this column to open the file in a new Code Explorer window.

    Open the file in Code Explorer

Next steps