开发者

How do I determine if a VSLangProj.Reference is a Project Reference or a File Reference?

开发者 https://www.devze.com 2023-01-20 17:24 出处:网络
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 20

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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号