A Visual Studio pacakge is a plugin of Visual Studio that can do (almost) anything inside Visual Studio
I have made a small project that generates a list of all solution ( or project) references from VS:
foreach (var project in dte.Solution.Projects)
{
var p = project as Project;
if (p == null)
{
continue;
}
var vsproject = p.Object as VSLangProj.VSProject;
if (vsproject == null)
continue;
string nameProject = p.Name;
foreach (var reference in vsproject.References)
{
var r = reference as Reference;
if (r == null)
continue;
var pathRef = r.Path;
//this is a package
var pa = new PackageAdd();
pa.ProjectName = p.Name;
pa.IdentifierPackage = r.Identity;
pa.VersionPackage = r.Version;
pa.NamePackage = r.Name;
if (r.SourceProject != null)
{
pa.NamePackage = r.SourceProject.Name;
}
sb.AppendLine(pa.ToString());
}
}
You can find the solution at https://github.com/ignatandrei/ToolsAndUtilities/tree/master/VS2015/FindReferencesVS
Also the video is at https://youtu.be/a3YHVjJ9fm4
Enjoy!
Leave a Reply