Udostępnij za pośrednictwem


SolutionBuild2.LastBuildInfo Property

Definition

Gets the number of projects that failed to build.

public:
 property int LastBuildInfo { int get(); };
public:
 property int LastBuildInfo { int get(); };
[System.Runtime.InteropServices.DispId(6)]
public int LastBuildInfo { [System.Runtime.InteropServices.DispId(6)] get; }
[<System.Runtime.InteropServices.DispId(6)>]
[<get: System.Runtime.InteropServices.DispId(6)>]
member this.LastBuildInfo : int
Public ReadOnly Property LastBuildInfo As Integer

Property Value

The number of projects that failed to build.

Implements

Attributes

Examples

This example builds the solution, and it then lists the number of failed builds. Open a project in the Visual Studio integrated development environment (IDE) before running this example.

Imports EnvDTE  
Imports EnvDTE80  
Sub SolutionLastBuildInfoExample(ByVal dte As DTE2)  
    ' Open a solution in Visual Studio before running this example.  
    Try  
        Dim soln As Solution2 = CType(_applicationObject.Solution, _  
        Solution2)  
        Dim sb As SolutionBuild2  
        Dim bld As BuildDependencies  
        sb = CType(soln.SolutionBuild, SolutionBuild2)  
        bld = sb.BuildDependencies  
        MsgBox("The project " & bld.Item(1).Project.Name & " has "  _  
        & bld.Count.ToString() & " build dependencies.")  
        ' Build the solution.  
        MsgBox("Building the solution...")  
        sb.Build(True)  
        MsgBox("Number of failed builds is: "  _  
        & sb.LastBuildInfo.ToString())  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using EnvDTE;  
using EnvDTE80;  
using System.Windows.Forms;  
public void SolutionLastBuildInfoExample(DTE2 dte)  
{  
    try  
    {  
        Solution2 soln = (Solution2)_applicationObject.Solution;  
        SolutionBuild2 sb;  
        BuildDependencies bld;  
        // Open a solution in Visual Studio before   
        // running this example.  
        sb = (SolutionBuild2)soln.SolutionBuild;  
        bld = sb.BuildDependencies;  
        MessageBox.Show("The project " + bld.Item(1).Project.Name +   
" has " + bld.Count.ToString() + " build dependencies.");  
        // Build the solution.  
        MessageBox.Show("Build the solution...");  
        sb.Build(true);  
        MessageBox.Show("Number of failed builds is: "   
+ sb.LastBuildInfo.ToString());  
    }  
    catch (Exception ex)  
    {  
        MessageBox.Show(ex.Message);  
    }  
}  

Remarks

A return value of zero indicates a successful build. The value of LastBuildInfo is undefined when the value of the BuildState property is vsBuildStateNotStarted.

Applies to