how to find reference path via *.csproject file


I want to make an automated powershell script, that reports the references and the referencepaths of a project.
When the hintpath in .csproj is not filled in, i can’t find a way to get the path to the reference.


Here’s a quick solution. It grabs every .csproj file under the current directory, and inspects each Reference. For assemblies referenced from the GAC, just the name is output. For assemblies outside the GAC, the full path to the assembly is output.

Note that by default, there are some registry entries that MSBuild looks in to find the locations of references that don’t have hint paths. You can see where MSBuild looks and where it locates assemblies by compiling with verbose logging turned on:


how to find reference path via *.csproject file by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply