Reference3.SubType 属性

设置或获取程序集子类型。

命名空间:  VSLangProj80
程序集:  VSLangProj80(在 VSLangProj80.dll 中)

语法

声明
Property SubType As String
string SubType { get; set; }
property String^ SubType {
    String^ get ();
    void set (String^ value);
}
abstract SubType : string with get, set
function get SubType () : String
function set SubType (value : String)

属性值

类型:System.String
一个表示程序集子类型的字符串值。对于 SQL Server Visual Basic 或 Visual C# 项目,如果从目标 SQL Server 检索该引用,则此属性设置为 SQLCLR。

备注

此属性只能在 SQL Server Visual Basic 或 Visual C# 项目上使用。

示例

此示例向打开的 Visual Basic 或 Visual C# 项目添加引用,并显示该引用的子类型(如果存在)。 若要将此示例作为外接程序运行,请参见如何:编译和运行自动化对象模型代码示例

所添加的引用的默认路径为:<驱动器>:\Program Files\Microsoft SQL Server\90\COM。 请将示例中的 <file path> 替换为此文件路径或另一个适当的文件路径。

Imports VSLangProj
Imports VSLangProj2
Imports VSLangProj80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    applicationObject = CType(application, DTE2)
    addInInstance = CType(addInInst, AddIn)
    DisplaySubType(applicationObject)
End Sub
Sub DisplaySubType(ByVal dte As DTE2)
    Dim aProject As Project
    Dim aVSProject As VSProject2
    aProject = applicationObject.Solution.Projects.Item(1)
    aVSProject = _
    CType(applicationObject.Solution.Projects.Item(1).Object, _
    VSProject2)
    ' Add an Assembly reference and display its subtype.
    Dim newRef As Reference3
    ' Replace <file path> with an actual file path.
    newRef = CType(aVSProject.References.Add _
("<file path>\sqldistx.dll "), Reference3)
    MsgBox("Added an assembly reference, named: " & newRef.Name)
    MsgBox("The SubType of " & newRef.Name & " is " _
    & newRef.SubType)
End Sub
using System.Windows.Forms;
using VSLangProj;
using VSLangProj2;
using VSLangProj80;
public void OnConnection(object application,
 ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    applicationObject = (DTE2)application;
    addInInstance = (AddIn)addInInst;
    DisplaySubType(((DTE2)applicationObject));
}
public void DisplaySubType(DTE2 dte)
{
    // The first project is a Visual Basic or C# project.
VSProject2 vsProject =
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));
    Reference3 aRef = null;
    // Add an Assembly reference and display its subtype.
    // Replace <file path> with an actual file path.
    aRef = (Reference3)vsProject.References.Add
((@"<file path>\sqldistx.dll"));
    MessageBox.Show("Added reference, named: "
+ aRef.Name);
MessageBox.Show("The SubType of " + aRef.Name + " is "
+ aRef.SubType);
}

.NET Framework 安全性

请参见

参考

Reference3 接口

VSLangProj80 命名空间