Which projects in my solution are using a project reference for a certain project?

4k views Asked by At

In my solution, I have a lot of projects which use project references to other projects in the solution. How do I figure out which projects reference a particular project?

5

There are 5 answers

3
Andrew On BEST ANSWER

A feature in Visual Studio exists for this. Right-click on your solution and click "Project Dependencies". Select the project that you want to find which other projects depend on it in the "Projects:" drop down list. Any projects that depend on the selected project will be unchecked and grayed out enter image description here because checking them enter image description here would cause a circular dependency.

4
Zack On

If you want to find out which projects use Project A as a project reference, the easiest way I've found is:

  • Do a "Clean" on Project A
  • Unload Project A
  • Rebuild the solution

You can determine which projects use Project A as a Project reference by examining which projects fail to build successfully at this point.

2
Alioza On

Use the Code Map feature in Visual Studio, it will show you the dependencies between your projects. Right click on your solution, Show on Code Map.

9
Rashedul.Rubel On

If a solution contains lots of projects, and some projects reference other projects in your solution then you can determine project dependencies by checking the dll inside reference folder under the particular project.

For example,

  • Suppose i have a solution named MyOwnProject.
  • Now Inside 'MyOwnProject' solutions there are 3 projects named:
    1. A (Main startup project)
    2. B (Class library)
    3. C (Class library)
  • Suppose A is the main startup UI project, and B and C are the class library projects.
  • If project A calls some functions that are defined inside project B, then project A needs a reference to project B in the reference folder of the project.
  • If a reference is missing when you build the solution, an error will show that points to function or method not found, because without a reference to project B, project A can't use any of the functions or methods of project B.
  • By reading the errors you can get an idea of the missing references.

After building the solution, all the DLLs inside the reference folder with "Copy Local" set to true are copied to the output folder for the projects configuration.

1
GrayCat On

The best way I know is to use ... Notepad++'s feature "Find in files".

You just put the name of the project that you want to find in "Find what:" field, filter on "*.csproj" and search in folder that contains your repository.

It is very fast and lets you find projects that reference this project not only in one solution but also in other solutions in the same folder if you have any.