A
AlexZh
Hi, I'd like to stop command line build by one project build failed.
To do that I've created simple AddIn (see code below), that works fine
for IDE and does not work for command line.
In the AddIn I have only two non-trivial methods:
In OnConnection I add my event handler to OnBuildProjConfigDone, and in
the event handler I executed Build.Cancel.
In IDE - no problem.
When I execute
still going.
What I do wrong? Maybe DTE.ExecuteCommand(...) waits for the end of
build in that mode...
Does anybody know how to make DTE.ExecuteCommand executes at the moment
of a call.
public void OnConnection(object application,
Extensibility.ext_ConnectMode connectMode, object addInInst, ref
System.Array custom)
{
applicationObject = (_DTE)application;
addInInstance = (AddIn)addInInst;
applicationObject.Events.BuildEvents.OnBuildProjConfigDone += new
_dispBuildEvents_OnBuildProjConfigDoneEventHandler(BuildEvents_OnBuildProjConfigDone);
}
public void BuildEvents_OnBuildProjConfigDone(string project, string
projectConfig, string platform, string solutionConfig, bool success)
{
if( !success )
{
applicationObject.DTE.ExecuteCommand("Build.Cancel", "");
}
}
Thank you,
Alex
To do that I've created simple AddIn (see code below), that works fine
for IDE and does not work for command line.
In the AddIn I have only two non-trivial methods:
In OnConnection I add my event handler to OnBuildProjConfigDone, and in
the event handler I executed Build.Cancel.
In IDE - no problem.
When I execute
I see that AddIn works and Build.Cancel is called but the build isdevenv /build mySolution
still going.
What I do wrong? Maybe DTE.ExecuteCommand(...) waits for the end of
build in that mode...
Does anybody know how to make DTE.ExecuteCommand executes at the moment
of a call.
public void OnConnection(object application,
Extensibility.ext_ConnectMode connectMode, object addInInst, ref
System.Array custom)
{
applicationObject = (_DTE)application;
addInInstance = (AddIn)addInInst;
applicationObject.Events.BuildEvents.OnBuildProjConfigDone += new
_dispBuildEvents_OnBuildProjConfigDoneEventHandler(BuildEvents_OnBuildProjConfigDone);
}
public void BuildEvents_OnBuildProjConfigDone(string project, string
projectConfig, string platform, string solutionConfig, bool success)
{
if( !success )
{
applicationObject.DTE.ExecuteCommand("Build.Cancel", "");
}
}
Thank you,
Alex