Freigeben über


SolutionBuild.StartupProjects Property

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

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

Syntax

'Declaration
Property StartupProjects As Object
Object StartupProjects { get; set; }
property Object^ StartupProjects {
    Object^ get ();
    void set (Object^ value);
}
abstract StartupProjects : Object with get, set
function get StartupProjects () : Object 
function set StartupProjects (value : Object)

Property Value

Type: System.Object
An object containing the names of projects that are the entry points for the application.

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.

Examples

public void CodeExample(DTE2 dte)
{  
    try
    {
        SolutionBuild sb = dte.Solution.SolutionBuild;
        SolutionConfiguration sc = 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);
    }
}

.NET Framework Security

See Also

Reference

SolutionBuild Interface

EnvDTE Namespace