I am wo开发者_开发百科rking on a Visual Studio plug-in. Given a VSLangProj.Reference, is there a way to programmatically determine if that reference is a project reference or a file reference?
in VS 2008 the Reference Type has a property called SourceProject
Gets a Project object if the reference is a project. Otherwise, it returns Nothing (a null reference). Read-only.
This is what I've got so far:
if (reference.Type == prjReferenceType.prjReferenceTypeActiveX)
{
// reference is a COM object
}
else if (reference.SourceProject != null)
{
// reference is a project in the solution
}
else if (!string.IsNullOrEmpty(reference.Path))
{
// "reference" is either
// an valid external dll
// or a project that is not in the solution and is referenced by a C++ project
}
else
{
// reference is either
// a project not in the solution
// or an external dll with invalid path
}
精彩评论