Creating a package with a toolwindow using the package wizard is easy because the wizard provides you an option to do it:
However, the steps to create a second toolwindow are not evident. And even if you figure out the steps, knowing what they do may be difficult. And if you come from the add-ins space (where toolwindow creation uses an easier approach), toolwindows of packages is difficult stuff. This question has appeared twice in the StackOverflow forum in the last days.
I have written the following article to explain the stuff generated by the wizard when you request the toolwindow option, how the pieces are connected, and why each piece is required:
HOWTO: Create a toolwindow with a ToolWindowPane class in a Visual Studio package
In my next post/article I will explain a different approach to create toolwindows in a package, without a ToolWindowPane (hence the title of this article).
2 thoughts on “MZ-Tools Articles Series: HOWTO: Create a toolwindow with a ToolWindowPane class in a Visual Studio package”
I am running Visual Studio 2012 Premium with Windows 7 on a 64-bit machine.
When I create a VS package via the wizard I get the standard tool window. First time I run VS and open the window it is fine. If I then close VS (leaving the tool window open) and re-open VS then I get an error with a stack trace:
System.Runtime.InteropServices.COMException (0x800401E3): Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
at Microsoft.VisualStudio.Shell.Interop.IVsShell5.LoadPackageWithContext(Guid& packageGuid, Int32 reason, Guid& context)
where the log file indicates: “SetSite failed for package”
This is standard stuff. Can you please explain how to get around this behavior and explain why this happens?
That should not happen, maybe there is something wrong on your VS installation. Can you reproduce it on a second computer with VS 2012 SDK?
Comments are closed.