Is it possible to hide the window generated when creating a project with Visual studio sdk?

Viewed 46

I am currently trying to create a visual studio project with the visual studio sdk in C# following those steps :

  • First I am using the DTE interface to open Visual studio
  • Then I create a new directory
  • Then I create a solution file
  • Finally I create the project in the solution using a template

Here is the code below :

       //Load DTE           
        Type t = System.Type.GetTypeFromProgID("VisualStudio.DTE.16.0");
        EnvDTE.DTE dte = (EnvDTE.DTE)System.Activator.CreateInstance(t);                  

        //Hide UI            
        dte.SuppressUI = true;
        dte.MainWindow.Visible = false;            

        //Create new directory           
        if (Directory.Exists(@"C:\Temp\SolutionFolder"))
            Directory.Delete(@"C:\Temp\SolutionFolder", true);
        Directory.CreateDirectory(@"C:\Temp\SolutionFolder");
        Directory.CreateDirectory(@"C:\Temp\SolutionFolder\SolutionTemp");

        //Create solution            
        dynamic solution = dte.Solution;
        solution.Create(@"C:\Temp\SolutionFolder", "SolutionTemp");
        solution.SaveAs(@"C:\Temp\SolutionFolder\SolutionTemp\MySolutionTemp.sln");

        //Create project with template           
        string template = @"C:\TwinCAT\3.1\Components\Base\PrjTemplate\TwinCAT Project.tsproj"; //path to project template
        dynamic project = solution.AddFromTemplate(template, @"C:\Temp\SolutionFolder\SolutionTemp", "MyTmpProject");         

Everything works fine but I have the window below that appears when i create my project but I want it to be hidden. Does anyone know how to hide the "project creation" window ?

Project creation window

PS : The project I am creating is a Twincat project (https://www.beckhoff.com/fr-fr/products/automation/twincat/) that is an IDE based on visual studio but it doesn't make any differences.

Thanks,

Emmanuel

0 Answers
Related