/// <summary>Form is closing so release instance of Visual Studio </summary> /// <param name="sender">Sender</param> /// <param name="e">Event Args</param> private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (dte2 != null) { dte2.Quit(); } }
public void QuitTargetDTE() { if (targetDTE2 != null) { targetDTE2.Quit(); targetDTE2 = null; } }
private void ShutDown() { try { _dte.Quit(); } catch { } }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (_DTE != null) { _DTE.Solution.Close(true); _DTE.Quit(); _DTE = null; } }
internal void Restart(string file) { Process process = new Process(); process.EnableRaisingEvents = true; process.StartInfo.FileName = file; process.StartInfo.UseShellExecute = true; process.Start(); DTE2.Quit(); }
/// <summary> /// Closes the DTE and makes sure the VS process is completely shutdown /// </summary> public void Close() { if (loaded) { log.Info("Closing the Visual Studio Development Tools Environment (DTE), please wait..."); Thread.Sleep(20000); // Makes sure that there are no visual studio processes left in the system if the user interrupts this program (for example by CTRL+C) dte.Quit(); } loaded = false; }
protected virtual void Dispose(bool disposing) { if (!Disposed) { if (disposing) { CurrnetDte = null; CurrnetDte.Quit(); } } //dispose unmanaged resources Disposed = true; }
/// <summary> /// This properly cleans up after StartVisualStudioInstance(). /// </summary> /// <param name="dte">Dte instance returned by StartVisualStudioInstance().</param> public static void CleanUpVisualStudioInstance(DTE2 dte) { if (dte != null) { if (dte.Solution != null) { dte.Solution.Close(); } dte.Quit(); } // Stop the message filter. ComMessageFilter.Revoke(); }
/// <summary> /// This properly cleans up after StartVisualStudioInstance(). /// </summary> /// <param name="dte">Dte instance returned by StartVisualStudioInstance().</param> public static void CleanUpVisualStudioInstance(DTE2 dte) { if (dte != null) { if (dte.Solution != null) { dte.Solution.Close(); } dte.Quit(); } // Stop the message filter. ComMessageFilter.Revoke(); }
static void Main(string[] args) { System.Type t = System.Type.GetTypeFromProgID("VisualStudio.DTE.8.0", true); DTE2 dte = (EnvDTE80.DTE2)System.Activator.CreateInstance(t, true); // See http://msdn.microsoft.com/en-us/library/ms228772.aspx for the // code for MessageFilter - just paste it into the so_sln namespace. MessageFilter.Register(); dte.Solution.Open(@"C:\path\to\my.sln"); foreach (Project project in dte.Solution.Projects) { Console.WriteLine(project.Name); } dte.Quit(); }
private static void DoTests(string vs) { var type = Type.GetTypeFromProgID(vs); DTE = (DTE2)Activator.CreateInstance(type); TestPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, vs); if (!Directory.Exists(TestPath)) { Directory.CreateDirectory(TestPath); } MessageFilter.Register(); DTE.MainWindow.Activate(); var options = new XmlWizardOptions(); options.AddinName = "_Name"; options.AddinManufacturer = "_AddinManufacturer"; options.AddinDescription = "_Description"; options.AddinEnabled = true; TestAddin(options); options.EnableWixSetup = true; TestSetup(options); options.AddinTypeCOM = false; options.AddinTypeVSTO = false; options.EnableWixSetup = true; options.AddinEnabled = false; TestVisioFiles(options); DTE.Quit(); MessageFilter.Revoke(); }
private void RestartVisualStudio() { System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetCurrentProcess(); System.Diagnostics.Process newProcess = new System.Diagnostics.Process(); newProcess.StartInfo = new System.Diagnostics.ProcessStartInfo { FileName = currentProcess.MainModule.FileName, ErrorDialog = true, UseShellExecute = true, Arguments = DTE2.CommandLineArguments }; newProcess.Start(); EnvDTE.Command command = DTE2.Commands.Item("File.Exit", -1); if ((command != null) && command.IsAvailable) { DTE2.ExecuteCommand("File.Exit", ""); } else { DTE2.Quit(); } }
public void Quit() { _dte.Quit(); }
private void ShutDown() { _dte.Quit(); }
public void CloseSolution() { _dteObj.Quit(); }
public static void ReleaseInstance() { mInstance.Quit(); MessageFilter.Revoke(); mInstance = null; }
public void Restart() { dte.Quit(); System.Diagnostics.Process.Start(dte.FileName); }
public void ShutdownIDE() { _dte.Quit(); MessageFilter.Revoke(); _dte = null; }
public void Restart() { _dte.Quit(); Process.Start(_dte.FileName); }