none
SolutionBuild.BuildProject hangs in VS2015 RRS feed

  • Question

  • I am using SolutionBuild.BuildProject interface mentioned in below documentation link.
    https://docs.microsoft.com/en-us/dotnet/api/envdte.solutionbuild.buildproject?view=visualstudiosdk-2015

    Issue: When the execution operation goes into building a project through the above Interface, it goes into hangs state.
    Could anyone please help to resolve the issue?

    Thanks in Advance,
    Sagar
    Thursday, November 28, 2019 10:13 AM

Answers

  • The root cause of the issue is observed as, Number of dependent projects required for Building the Active Project.

    Since, I am using SolutionBuild.Clean interface before BuildProject, as below and the project has close to 60 dependent projects to be cleaned and rebuilt, it was creating an issue.

    DTE dte= ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE;
    EnvDTE.Project project = 
    dte.ActiveDocument.ProjectItem.ContainingProject;
    
    var application = project.DTE;
    application.Solution.SolutionBuild.Clean(true);
    
    string configurationName = application.Solution.SolutionBuild.ActiveConfiguration.Name;
    string projectName = project.UniqueName;
    application.Solution.SolutionBuild.BuildProject(
                    configurationName,
                    projectName, 
                    true);
    Solution:

    Add Thread.Sleep(5000) between SolutionBuild.Clean and SolutionBuild.BuildProject, if there are good number of dependent projects associated with ActiveProject.


    • Marked as answer by Sagar R Kale Friday, December 6, 2019 9:36 AM
    • Edited by Sagar R Kale Friday, December 6, 2019 9:37 AM corrected Solution to SolutionBuild
    Friday, December 6, 2019 9:35 AM

All replies

  • Hi Safar R Kale,

    Welcome to MSDN forum.

    According to your description, could you please share a simple sample to help us reproduce this issue? And I found a similar issue on stack overflow, maybe it could help you.

    Look forward to your reply.

    Best regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, November 29, 2019 7:07 AM
  • Thanks for your response Dylan.
    I am verifying the suggested solution and will update my findings soon in the same thread.

    Thank you,
    Sagar

    Tuesday, December 3, 2019 2:29 PM
  • The root cause of the issue is observed as, Number of dependent projects required for Building the Active Project.

    Since, I am using SolutionBuild.Clean interface before BuildProject, as below and the project has close to 60 dependent projects to be cleaned and rebuilt, it was creating an issue.

    DTE dte= ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE;
    EnvDTE.Project project = 
    dte.ActiveDocument.ProjectItem.ContainingProject;
    
    var application = project.DTE;
    application.Solution.SolutionBuild.Clean(true);
    
    string configurationName = application.Solution.SolutionBuild.ActiveConfiguration.Name;
    string projectName = project.UniqueName;
    application.Solution.SolutionBuild.BuildProject(
                    configurationName,
                    projectName, 
                    true);
    Solution:

    Add Thread.Sleep(5000) between SolutionBuild.Clean and SolutionBuild.BuildProject, if there are good number of dependent projects associated with ActiveProject.


    • Marked as answer by Sagar R Kale Friday, December 6, 2019 9:36 AM
    • Edited by Sagar R Kale Friday, December 6, 2019 9:37 AM corrected Solution to SolutionBuild
    Friday, December 6, 2019 9:35 AM