1

Is there any possibiliy to searh the whole solution to see a particular refrence's usage?

Let's say, can I see in what projects the reference "Xyxyxyxy.dll" is referenced?

(ReSharper based answers are also acceptable! :) )

Thanks!

pencilCake
  • 51,323
  • 85
  • 226
  • 363

3 Answers3

2

You can do this through notepad++ quite easily by giving the solution directory and *.csproj as the filter i.e. searching the csproj files for the references.

  • In case you want to search for GAC assembly references, search for the following string

    <Reference Include="System.Data" /> where System.Data is the assembly name

  • In case you want to search for a non GAC referenced assembly then search for the following string

    <Reference Include="WindowsFormsApplication2, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">

    Search in notepad++

Devendra D. Chavan
  • 8,871
  • 4
  • 31
  • 35
  • Using Resharper's functionality as described by @Ilya Ryzhenkov's answer is far easier and helpful. Your method would be ok if you weren't using Resharper, but if you're not then why not? – Piers Myers Sep 14 '11 at 16:31
  • The question requires to search the entire solution and not a single project. Such a feature is not available in ReSharper. – Devendra D. Chavan Sep 15 '11 at 03:03
  • the 'Project Hierarchy' feature in Resharper shows all the Projects in your entire Solution that have the same reference as you selected. The 'Find Code Dependant on Module' feature will only work on one Project at a time. – Piers Myers Sep 15 '11 at 08:48
2

You can use Project Hierarchy feature of ReSharper to see back and forward reference links. Right click your reference or project, choose Project Hierarchy.

Ilya Ryzhenkov
  • 11,782
  • 1
  • 40
  • 50
  • Very nice feature that I'd not used before. You can then use 'Find Code Dependant on Module' to see if is actually used at all. – Piers Myers Sep 14 '11 at 16:26
0

Devendra's answer already shows how you can get an answer to the question by doing a simple text search. I thought it might be worth showing that you can do the same thing using only PowerShell (in case you don't have an editor other than Visual Studio installed):

gci -Recurse -Filter '*.csproj' |
    where { $_ | sls '<Reference.*"System\.Data("|,)' } |
    select -ExpandProperty Name

Replace System\.Data with the full name of the assembly you're searching for.

Community
  • 1
  • 1
Michael Kropat
  • 14,557
  • 12
  • 70
  • 91