Freigeben über


SolutionBuild2.StartupProjects Property

Definition

Gets or sets the names of projects that are entry points for the application.

public:
 property System::Object ^ StartupProjects { System::Object ^ get(); void set(System::Object ^ value); };
public:
 property Platform::Object ^ StartupProjects { Platform::Object ^ get(); void set(Platform::Object ^ value); };
[System.Runtime.InteropServices.DispId(7)]
public object StartupProjects { [System.Runtime.InteropServices.DispId(7)] get; [System.Runtime.InteropServices.DispId(7)] set; }
[<System.Runtime.InteropServices.DispId(7)>]
[<get: System.Runtime.InteropServices.DispId(7)>]
[<set: System.Runtime.InteropServices.DispId(7)>]
member this.StartupProjects : obj with get, set
Public Property StartupProjects As Object

Property Value

An object containing the names of projects that are the entry points for the application.

Implements

Attributes

Examples

This example determines the build status for each active startup configuration. Open a project in the Visual Studio integrated development environment (IDE) before running this example.

Imports EnvDTE  
Imports EnvDTE80  
Sub SolutionBuild2Example(ByVal dte As DTE2)  
    ' Open a solution in the Visual Studio IDE  
    ' before running this example.  
    Try  
        Dim sb As SolutionBuild2  
        sb = CType(_applicationObject.Solution.SolutionBuild _  
        , SolutionBuild2)  
        Dim sc As SolutionConfiguration2  
        sc = CType(sb.ActiveConfiguration, SolutionConfiguration2)  
        Dim vsBldSt As vsBuildState  
        Dim msg As String = "Return relative path to startup  _  
        projects: "  
        For Each s As String In CType(sb.StartupProjects, Array)  
            msg &= vbCr & " " & s  
        Next  
        msg &= vbCr & "SolutionConfiguration: " & sc.Name  
        vsBldSt = sb.BuildState  
        If (vsBldSt = vsBuildState.vsBuildStateDone) Then  
            msg &= vbCr & "A build has occurred."  
        ElseIf (vsBldSt = vsBuildState.vsBuildStateInProgress) Then  
            msg &= vbCr & "A build is in progress."  
        Else : msg &= vbCr & "A build has not occurred."  
        End If  
        MsgBox(msg)  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using EnvDTE;  
using EnvDTE80;  
using System.Windows.Forms;  
public void SolutionBuild2Example(DTE2 dte)  
{  
    try  
    {  
        SolutionBuild2 sb =  
 (SolutionBuild2)_applicationObject.Solution.SolutionBuild;  
        SolutionConfiguration2 sc =  
 (SolutionConfiguration2)sb.ActiveConfiguration;  
        vsBuildState vsBS;  
        string msg = "Return relative path to startup projects: ";  
        foreach (String s in (Array)sb.StartupProjects)  
        {  
            msg += "\n   " + s;  
        }  
        msg += "\nSolutionConfiguration: " + sc.Name;  
        vsBS = sb.BuildState;  
        if (vsBS == vsBuildState.vsBuildStateDone)  
            msg += "\nA build has occurred.";  
        else if (vsBS == vsBuildState.vsBuildStateInProgress)  
            msg += "\nA build is in progress.";  
        else msg += "\nA build has not occurred.";  
        MessageBox.Show(msg);  
    }  
    catch(Exception ex)  
    {  
        MessageBox.Show(ex.Message);  
    }  
}  

Remarks

StartupProjects contains a list of project name strings that "start" when the Run command is issued. Each project and language defines what starting means as well as what occurs when a project is started. For example, a Visual C++ project starts by executing the main() function, and Visual Basic executes Sub Main() or a startup form. Other projects and languages use a project property for a class or function name, while others use an interface that must be implemented, and so on.

Applies to