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?
Which projects in my solution are using a project reference for a certain project?
3.9k views Asked by Zack AtThere are 5 answers
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.
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:
- A (Main startup project)
- B (Class library)
- 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.
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.
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 because checking them would cause a circular dependency.