'Create Visual Studio plugin to launch window form application inside visual studio(not standalone)

I have a window based tool which is currently working. I need to add this tool as a plugin/extension in visual studio. So that if user has visual studio installed then this tool can be opened from visual studio menu. And when opened from visual studio it should be opened as model dialog inside visual studio not a separate application (as we open with process.start). Please suggest for the same. Thanks.



Solution 1:[1]

According to your description, I think you could use custom toolwindow to achieve it. for more information, please refer to: https://msdn.microsoft.com/en-us/library/cc138567.aspx

Starting from Visual Studio 2010, tool windows themselves were based on WPF technology, although they still provide backward compatibility for hosting of WinForms components.

If you use Winform Control, please refer to the following code.

namespace TWToolbar
{
    using System;
    using System.Runtime.InteropServices;
    using Microsoft.VisualStudio.Shell;
    using System.ComponentModel.Design;
    using System.Collections.Generic;


    /// <summary>
    /// This class implements the tool window exposed by this package and hosts a user control.
    /// </summary>
    /// <remarks>
    /// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane,
    /// usually implemented by the package implementer.
    /// <para>
    /// This class derives from the ToolWindowPane class provided from the MPF in order to use its
    /// implementation of the IVsUIElementPane interface.
    /// </para>
    /// </remarks>
    [Guid("1a24c96c-30bd-466b-8315-14bf54e4f17a")]
    public class TestToolWindow : ToolWindowPane
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="TestToolWindow"/> class.
        /// </summary>
        /// 
        public UserControl1 control;
        public TestToolWindow() : base(null)
        {
            this.Caption = "TestToolWindow";
         // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            this.control = new UserControl1();//new TestToolWindowControl(users);
       }

        override public System.Windows.Forms.IWin32Window Window
        {
            get
            {
                return (System.Windows.Forms.IWin32Window)control;
            }
        }
    }
}

enter image description here

Sample project: https://1drv.ms/u/s!AlvaNEnglADDgRMFqXKjdb63OeeK

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zhanglong Wu - MSFT