我正在使用Visual Studio插件。给定一个VSLangProj.Reference,有没有办法以编程方式确定该引用是项目引用还是文件引用?
答案 0 :(得分:0)
如果引用是项目,则获取Project对象。否则,它返回Nothing(空引用)。只读。
答案 1 :(得分:0)
这是我到目前为止所得到的:
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
}