Reference3.BuildNumber 属性

获取引用的生成号。

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

语法

声明
ReadOnly Property BuildNumber As Integer
int BuildNumber { get; }
property int BuildNumber {
    int get ();
}
abstract BuildNumber : int
function get BuildNumber () : int

属性值

类型:System.Int32
一个 long 类型的值。返回值取决于引用类型。

引用类型

返回的值

程序集

引用的生成号;0-9999。

COM

0

备注

BuildNumber 属性获取版本号的“内部版本”部分。引用的版本由四个部分唯一标识,它们是:主版本、次版本、内部版本 和修订版本。主版本 和次版本 部分是必需的。未定义内部版本 时,修订版本 部分是可选的。COM 对象没有修订版本 和内部版本 部分。有关更多信息,请参见 程序集版本控制

示例

此示例向打开的 Visual Basic 或 Visual C# 项目添加程序集和 COM 引用,并在消息框中显示每个引用的生成号。若要将此示例作为外接程序运行,请参见如何:编译和运行自动化对象模型代码示例

所添加的引用的默认路径为:对于 adodb.dll 为 <安装根目录>\Program Files\Microsoft.NET\Primary Interop Assemblies,对于 spcommon.dll 为 <安装根目录>\Program Files\Common Files\SpeechEngines\Microsoft。请将示例中的 <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)
    AddRefPlusBuild(applicationObject)
End Sub
Sub AddRefPlusBuild(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 build number.
    Dim newRef As Reference3
    ' Replace <file path> with an actual file path.
    newRef = aVSProject.References.Add("<file path>\adodb.dll")
    MsgBox("The " & newRef.Name() & " has a build number:" & vbCr _
    & newRef.BuildNumber.ToString())
    ' Add a COM reference and display its build number. Should be 0.
    ' Replace <file path> with an actual file path.
    newRef = aVSProject.References.Add("<file path>\spcommon.dll")
    MsgBox("The " & newRef.Name() & " has a build number:" & _
    vbCr & newRef.BuildNumber.ToString())
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;
    AddRefPlusBuild(((DTE2)applicationObject));
}
public void AddRefPlusBuild(DTE2 dte)
{
    Project aProject = null;
    VSProject2 aVSProject = null;
    aProject = applicationObject.Solution.Projects.Item(1);
    aVSProject = 
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));
    // Add an Asembly reference and display its build number.
    Reference3 newRef = null;
    // Replace <file path> with an actual file path.
    newRef = ((Reference3)(aVSProject.References.Add(@"
<file path>\adodb.dll")));
    MessageBox.Show("The " + newRef.Name.ToString() + 
" has a build number:" + "\n" + newRef.BuildNumber.ToString());  
    // Add a COM reference and display its build number.
    // Replace <file path> with an actual file path.
    newRef = ((Reference3)(aVSProject.References.Add(@"
<file path>\spcommon.dll")));
    MessageBox.Show("The " + newRef.Name.ToString() + " has a build 
number:" + "\n" + newRef.BuildNumber.ToString()); 
}

.NET Framework 安全性

请参见

参考

Reference3 接口

BuildNumber 重载

VSLangProj80 命名空间