SolutionBuild.BuildState Property
Gets whether a build has ever been started in the current environment session, whether a build is currently in progress, or whether a build has been completed.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
ReadOnly Property BuildState As vsBuildState
vsBuildState BuildState { get; }
property vsBuildState BuildState {
vsBuildState get ();
}
abstract BuildState : vsBuildState with get
function get BuildState () : vsBuildState
Property Value
Type: EnvDTE.vsBuildState
A vsBuildState value representing the status of the build operation.
Remarks
BuildState has vsBuildStateNotStarted so that you can detect a race condition; that is, when you start the environment to do a build and then check its build state before the build has actually begun. Checking to see if vsBuildState equals vsBuildStateNotStarted allows you to avoid this situation. It also allows you to determine whether the value of the LastBuildInfo property is valid.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.