21

Is there an easy way to find all references to the project in solution in VS2010? In fact I have a solution with 43 projects in it and I want to make sure there are no projects that have references to Project#N.

Thanks

4 Answers 4

34

Easy but dull way: right-click on solution, choose Project Dependencies, choose the first project in the Projects drop down list, and use down arrow to scroll through projects. For each project in Project box look if your project of interested checked in the list - that's most probably will make your list.

Or you can use Resharper for this:

  • Right-click on module and choose Find Code Dependent on Module to find all projects which really use this module (this will not show references which exist, but not used).
  • Right-click on module and choose Project Hierarchy, then click "Referencing projects" to see all project references
3
  • "Find Code Dependent on Module" from Resharper works perfect! Thanks!
    – Galina
    Apr 3, 2013 at 14:12
  • At least the first part of the answer is wrong. It lists dependencies for the projects, not dependent projects.
    – Yola
    May 16, 2020 at 14:26
  • that's why you need to scroll through each and every project
    – Lanorkin
    Apr 22, 2022 at 10:07
15

The build-in Project Dependencies command only works the other way, i.e., it finds a given project's dependencies, not projects dependent on the given one—unless of course you feel like selecting each of your 200 projects in turn in the dropdown, and then for each project, scrolling down the also voluminous list below to see if the project of interest is included.

Instead, in the absence of Resharper you can use Find in Files (CTRL SHIFT F) to list projects in the solution that refer to the project of interest:

enter image description here

1
  • This approach shows promise, but I found that it only works for my NetStandard and .NET Core projects; it doesn't find any references from my classic .NET Framework projects.
    – BCA
    Feb 12, 2021 at 13:54
8

If you are lazy and do not have Resharper, you can also unload the project, try building the solution again and see wich projects fail building.

2
  • 2
    Unloading the project will not break the build with the new .NET Core csproj files. Mar 12, 2020 at 12:03
  • Beware that, although selecting to Remove the project will show you the reference errors, it will also remove the references to the now-deleted project in all other projects that referenced it. I made this mistake, and if it weren't for Git undo, I'd have to manually add back references in a dozen projects
    – BCA
    Feb 12, 2021 at 13:47
0

A few of these non-Resharper answers are good, but only work for certain project types and not others.

I do not have Resharper and DO have a mix of project types (NetStandard, .NET Core, .NET Framework, UWP) and here is a simple approach that worked for me:

First, unload the project of interest (in my example, TWW.Common.DataModel).

Go to your Error List, select Entire Solution, enable the display of Warnings, and in the search field, enter "The referenced component"*. It will filter the list to show all projects that now have this missing reference:

Error list

* or whatever text Visual Studio uses for this type of warning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.