次の方法で共有


Reference3.SubType Property

Sets or Gets the assembly subtype.

Namespace:  VSLangProj80
Assembly:  VSLangProj80 (in VSLangProj80.dll)

Syntax

'Declaration
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)

Property Value

Type: System.String
A string value representing the assembly's subtype. For SQL Server Visual Basic or Visual C# projects, this property is set to SQLCLR if the reference was retrieved from the target SQL server.

Remarks

This property is useful only on SQL Server Visual Basic or Visual C# projects.

Examples

This example adds a reference to an open Visual Basic or Visual C# project and displays the reference subtype, if one exists. To run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

The default paths for the reference added is: <drive>:\Program Files\Microsoft SQL Server\90\COM. Replace <file path> in the example with this or another appropriate 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 Security

See Also

Reference

Reference3 Interface

VSLangProj80 Namespace