如何确定 VSLangProj.Reference 是项目引用还是文件引用?

发布于 2024-09-28 08:41:17 字数 85 浏览 1 评论 0原文

我正在开发 Visual Studio 插件。给定 VSLangProj.Reference,是否有一种方法可以以编程方式确定该引用是项目引用还是文件引用?

I am working 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

转瞬即逝 2024-10-05 08:41:17

VS 2008 中,引用类型具有名为 SourceProject 的属性

如果引用是项目,则获取 Project 对象。否则,它返回 Nothing(空引用)。只读。

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.

情绪操控生活 2024-10-05 08:41:17

这是我到目前为止所得到的:

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
}

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
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文