There are specific logic that I need to handle on build completed depending on whether or not the solution compiled/built with no error.
How can I detect if the last build generated any error?
vsBuildState contains definition for Done, InProgress, and NotStarted, where do I check for errors?
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
_buildEvents = _applicationObject.Events.BuildEvents;
_buildEvents.OnBuildBegin += customBuildHandler;
_buildEvents.OnBuildDone += customBuildEndHandler;
}
void customBuildEndHandler(vsBuildScope Scope, vsBuildAction Action)
{
if(IsLastBuildSuccessful) // How can I determine this?
{
//Do Something
}
}
Inside the event handler you need to intercept the state of last build using the LastBuildInfo variable. Refer : http://msdn.microsoft.com/en-US/library/envdte.solutionbuild.lastbuildinfo(v=vs.100).aspx
var solution = _applicationObject.Solution;
var lastBuildState = solution.SolutionBuild.LastBuildInfo;
if(lastBuildState == 0)
//Build succeeded
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.