Reference3.BuildNumber Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Obtém o número de Build da referência.
public:
property int BuildNumber { int get(); };
public:
property int BuildNumber { int get(); };
[System.Runtime.InteropServices.DispId(14)]
public int BuildNumber { [System.Runtime.InteropServices.DispId(14)] get; }
[<System.Runtime.InteropServices.DispId(14)>]
[<get: System.Runtime.InteropServices.DispId(14)>]
member this.BuildNumber : int
Public ReadOnly Property BuildNumber As Integer
Valor da propriedade
Um valor longo. O valor retornado depende do tipo de referência. Tipo de referência ReturnedAssemblyBuild número da referência; 0 -9999. COM0
Implementações
- Atributos
Exemplos
Este exemplo adiciona um assembly e uma referência COM a um Open Visual Basic ou Visual C# Project e exibe o número de Build para cada referência em uma caixa de mensagem. Para executar este exemplo como um suplemento, consulte como compilar e executar os exemplos de código de modelo de objeto de automação.
Os caminhos padrão para as referências adicionadas são: <installation root> \Program Files\Microsoft.NET\Primary Interop assemblies para adodb.dll e <installation root> \Program Files\Common Files\SpeechEngines\Microsoft for spcommon.dll. Substitua <file path> no exemplo por esses ou outros caminhos de arquivo apropriados.
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());
}
Comentários
A BuildNumber propriedade Obtém o componente de compilação de um número de versão. A versão de uma referência é identificada exclusivamente por quatro componentes: principal, secundária, compilação e revisão. Os componentes principais e secundários são necessários. O componente de revisão é opcional quando a compilação não está definida. Objetos COM não têm componentes de revisão e de compilação . Para obter mais informações, consulte Controle de versão do assembly.