/vs-extensibility-skills:showing-info-barsfrom vs-extensibility-skills
Shows InfoBar (gold bar) notifications in Visual Studio extensions across multiple SDK approaches. Helps display non-blocking notifications in tool windows, document windows, or the main IDE window.
Ships in vs-extensibility-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
An InfoBar (also called a gold bar or yellow bar) is a non-blocking notification that appears at the top of a tool window, document window, or the main IDE window. Use it when you need the user's attention but don't want to interrupt their workflow.
InfoBars are the right default for most extension notifications because they're non-blocking — the user can continue working and respond when ready. They persist until explicitly dismissed (unlike status bar messages that disappear) and support actionable links and buttons. Using a message box when an info bar would suffice trains users to reflexively dismiss dialogs, reducing the effectiveness of truly important prompts.
When to use an InfoBar vs. alternatives:
| Mechanism | Blocking? | When to use |
|---|---|---|
| Status bar | No | Non-critical info the user doesn't need to act on |
| InfoBar | No | Important but non-blocking — user can act when ready |
| Message box / User prompt | Yes | User must acknowledge or choose before continuing |
| Output window | No | Logging and diagnostic information |
| Location | When to use |
|---|---|
| Tool window (e.g., Solution Explorer) | Notification related to a specific tool window's content |
| Document window | Notification relevant to a specific open file |
| Main window (global) | IDE-wide notification (use sparingly — causes layout shift) |
Best practice: Keep InfoBar text short and actionable. Show at most one or two action items. Avoid stacking many InfoBars — the user sees a maximum of three before the region becomes scrollable.
The VisualStudio.Extensibility SDK does not currently provide a dedicated InfoBar API. For non-blocking notifications in out-of-process extensions, use User Prompts (ShellExtensibility.ShowPromptAsync()), which display a non-modal dialog.
If you specifically need an InfoBar (e.g., attached to a tool window), you must use an in-proc compatible extension — one that sets RequiresInProcessHosting = true in its ExtensionConfiguration — and then use the VSSDK or Toolkit APIs described below.
NuGet package: Microsoft.VisualStudio.Extensibility
Key namespace: Microsoft.VisualStudio.Extensibility.Shell
[VisualStudioContribution]
internal class NotifyCommand : Command
{
public NotifyCommand(VisualStudioExtensibility extensibility)
: base(extensibility) { }
public override CommandConfiguration CommandConfiguration => new("Notify User")
{
Placements = [CommandPlacement.KnownPlacements.ToolsMenu],
};
public override async Task ExecuteCommandAsync(
IClientContext context, CancellationToken ct)
{
// Non-blocking prompt — closest out-of-proc alternative to an InfoBar
bool update = await this.Extensibility.Shell().ShowPromptAsync(
"An update is available. Would you like to install it now?",
PromptOptions.OKCancel,
ct);
if (update)
{
// Perform the update
}
}
}
[VisualStudioContribution]
internal class MyExtension : Extension
{
public override ExtensionConfiguration? ExtensionConfiguration => new()
{
RequiresInProcessHosting = true,
};
}
[VisualStudioContribution]
internal class ShowInfoBarCommand : Command
{
public ShowInfoBarCommand(VisualStudioExtensibility extensibility)
: base(extensibility) { }
public override CommandConfiguration CommandConfiguration => new("Show InfoBar")
{
Placements = [CommandPlacement.KnownPlacements.ToolsMenu],
};
public override async Task ExecuteCommandAsync(
IClientContext context, CancellationToken ct)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
// Use VSSDK InfoBar from in-proc hybrid extension
var model = new InfoBarModel(
new[] {
new InfoBarTextSpan("A new version is available. "),
new InfoBarHyperlink("Update now")
},
KnownMonikers.StatusInformation,
isCloseButtonVisible: true);
IVsInfoBarUIFactory factory = (IVsInfoBarUIFactory)
ServiceProvider.GlobalProvider.GetService(typeof(SVsInfoBarUIFactory));
IVsInfoBarUIElement uiElement = factory.CreateInfoBar(model);
// Show in main window
IVsShell shell = (IVsShell)
ServiceProvider.GlobalProvider.GetService(typeof(SVsShell));
shell.GetProperty((int)__VSSPROPID7.VSSPROPID_MainWindowInfoBarHost,
out object hostObj);
if (hostObj is IVsInfoBarHost host)
{
host.AddInfoBar(uiElement);
}
}
}
The Toolkit provides a clean InfoBar wrapper through VS.InfoBar. It significantly simplifies creating InfoBars and handling events. All factory methods are async and return InfoBar? (nullable — null if the host window couldn't be found).
NuGet package: Community.VisualStudio.Toolkit
Key namespace: Community.VisualStudio.Toolkit
var model = new InfoBarModel(
new[] {
new InfoBarTextSpan("The project needs to be restored. "),
new InfoBarHyperlink("Restore now")
},
KnownMonikers.NuGet,
isCloseButtonVisible: true);
// Show in Solution Explorer by passing its GUID
InfoBar? infoBar = await VS.InfoBar.CreateAsync(ToolWindowGuids80.SolutionExplorer, model);
if (infoBar != null)
{
infoBar.ActionItemClicked += InfoBar_ActionItemClicked;
await infoBar.TryShowInfoBarUIAsync();
}
// ...
private void InfoBar_ActionItemClicked(object sender, InfoBarActionItemEventArgs e)
{
ThreadHelper.ThrowIfNotOnUIThread();
if (e.ActionItem.Text == "Restore now")
{
// Perform the restore
}
}
Pass the file path of the open document instead of a GUID:
var model = new InfoBarModel("This file has been modified outside the editor.");
string filePath = @"C:/Projects/MyApp/Program.cs";
InfoBar? infoBar = await VS.InfoBar.CreateAsync(filePath, model);
await infoBar?.TryShowInfoBarUIAsync();
Use the parameterless VS.InfoBar.CreateAsync() to attach the InfoBar to the VS main window:
var model = new InfoBarModel(
new[] {
new InfoBarTextSpan("A critical update is available. "),
new InfoBarHyperlink("Learn more"),
new InfoBarTextSpan(" "),
new InfoBarButton("Install")
},
KnownMonikers.StatusWarning,
isCloseButtonVisible: true);
// CreateAsync (no window parameter) → main window InfoBar
InfoBar? infoBar = await VS.InfoBar.CreateAsync(model);
if (infoBar != null)
{
infoBar.ActionItemClicked += OnGlobalInfoBarAction;
await infoBar.TryShowInfoBarUIAsync();
}
// ...
private void OnGlobalInfoBarAction(object sender, InfoBarActionItemEventArgs e)
{
ThreadHelper.ThrowIfNotOnUIThread();
if (e.ActionItem.Text == "Install")
{
// Start update
}
else if (e.ActionItem.Text == "Learn more")
{
System.Diagnostics.Process.Start("https://example.com/release-notes");
}
}
When you have a custom ToolWindowPane, the Toolkit's InfoBar class works with any IVsWindowFrame. But you can also use the built-in ToolWindowPane.AddInfoBar() method directly:
[Guid("your-tool-window-guid")]
public class MyToolWindow : ToolWindowPane
{
public MyToolWindow() : base(null)
{
Caption = "My Tool Window";
Content = new MyToolWindowControl();
}
public async Task ShowInfoBarAsync()
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
var model = new InfoBarModel(
new[] {
new InfoBarTextSpan("Configuration changed. "),
new InfoBarHyperlink("Reload")
},
KnownMonikers.Refresh,
isCloseButtonVisible: true);
// Option A: Use the Toolkit wrapper
string toolWindowGuid = typeof(MyToolWindow).GUID.ToString("B");
InfoBar? infoBar = await VS.InfoBar.CreateAsync(toolWindowGuid, model);
await infoBar?.TryShowInfoBarUIAsync();
// Option B: Use ToolWindowPane's built-in method
AddInfoBar(model);
}
// ToolWindowPane raises these events for InfoBars added via AddInfoBar()
protected override void OnInfoBarClosed(IVsInfoBarUIElement element)
{
// InfoBar was closed by the user
}
protected override void OnInfoBarActionItemClicked(
IVsInfoBarUIElement element, IVsInfoBarActionItem actionItem)
{
ThreadHelper.ThrowIfNotOnUIThread();
if (actionItem.Text == "Reload")
{
// Reload configuration
}
}
}
The Toolkit provides an extension method to attach an InfoBar directly to a text view:
InfoBar? infoBar = await textView.CreateInfoBarAsync(model);
await infoBar?.TryShowInfoBarUIAsync();
infoBar.Close();
The VSSDK requires you to manually create the InfoBarModel, use IVsInfoBarUIFactory to produce a IVsInfoBarUIElement, find the appropriate IVsInfoBarHost, add the element, and subscribe to events via Advise/Unadvise.
NuGet package: Microsoft.VisualStudio.SDK
Key namespaces: Microsoft.VisualStudio.Shell, Microsoft.VisualStudio.Shell.Interop
public async Task ShowInfoBarInToolWindowAsync()
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
// 1. Build the model
var model = new InfoBarModel(
textSpans: new IVsInfoBarTextSpan[]
{
new InfoBarTextSpan("This is a "),
new InfoBarHyperlink("hyperlink"),
new InfoBarTextSpan(" InfoBar.")
},
actionItems: new IVsInfoBarActionItem[]
{
new InfoBarButton("Click Me")
},
image: KnownMonikers.StatusInformation,
isCloseButtonVisible: true);
// 2. Create the UI element
IVsInfoBarUIFactory factory = (IVsInfoBarUIFactory)
await GetServiceAsync(typeof(SVsInfoBarUIFactory));
IVsInfoBarUIElement uiElement = factory.CreateInfoBar(model);
// 3. Subscribe to events
uiElement.Advise(new InfoBarEventSink(), out uint cookie);
// 4. Find the host (Solution Explorer in this example)
IVsUIShell uiShell = (IVsUIShell)
await GetServiceAsync(typeof(SVsUIShell));
Guid toolWindowGuid = new Guid(ToolWindowGuids80.SolutionExplorer);
uiShell.FindToolWindow(
(uint)__VSFINDTOOLWIN.FTW_fForceCreate,
ref toolWindowGuid, out IVsWindowFrame frame);
frame.GetProperty(
(int)__VSFPROPID7.VSFPROPID_InfoBarHost, out object hostObj);
if (hostObj is IVsInfoBarHost host)
{
host.AddInfoBar(uiElement);
}
}
public async Task ShowGlobalInfoBarAsync()
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
var model = new InfoBarModel("A global notification message.",
KnownMonikers.StatusWarning, isCloseButtonVisible: true);
IVsInfoBarUIFactory factory = (IVsInfoBarUIFactory)
await GetServiceAsync(typeof(SVsInfoBarUIFactory));
IVsInfoBarUIElement uiElement = factory.CreateInfoBar(model);
// Get the main window InfoBar host
IVsShell shell = (IVsShell)await GetServiceAsync(typeof(SVsShell));
shell.GetProperty(
(int)__VSSPROPID7.VSSPROPID_MainWindowInfoBarHost, out object hostObj);
if (hostObj is IVsInfoBarHost host)
{
host.AddInfoBar(uiElement);
}
}
public async Task ShowInfoBarInDocumentAsync(string filePath)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
if (!VsShellUtilities.IsDocumentOpen(
ServiceProvider.GlobalProvider, filePath, Guid.Empty,
out _, out _, out IVsWindowFrame frame))
{
return; // Document not open
}
var model = new InfoBarModel("This document has issues.");
IVsInfoBarUIFactory factory = (IVsInfoBarUIFactory)
ServiceProvider.GlobalProvider.GetService(typeof(SVsInfoBarUIFactory));
IVsInfoBarUIElement uiElement = factory.CreateInfoBar(model);
frame.GetProperty(
(int)__VSFPROPID7.VSFPROPID_InfoBarHost, out object hostObj);
if (hostObj is IVsInfoBarHost host)
{
host.AddInfoBar(uiElement);
}
}
ToolWindowPane has built-in support via AddInfoBar():
[Guid("your-tool-window-guid")]
public class MyToolWindow : ToolWindowPane
{
public void ShowInfoBar()
{
ThreadHelper.ThrowIfNotOnUIThread();
var model = new InfoBarModel(
"Configuration has changed.",
new[] { new InfoBarButton("Reload") },
KnownMonikers.Refresh);
// AddInfoBar is a built-in ToolWindowPane method
AddInfoBar(model);
}
// Built-in event handlers
protected override void OnInfoBarClosed(IVsInfoBarUIElement element)
{
// Clean up
}
protected override void OnInfoBarActionItemClicked(
IVsInfoBarUIElement element, IVsInfoBarActionItem actionItem)
{
ThreadHelper.ThrowIfNotOnUIThread();
if (actionItem.Text == "Reload")
{
// Reload
}
}
}
When not using ToolWindowPane.AddInfoBar(), implement IVsInfoBarUIEvents to handle clicks and close:
internal class InfoBarEventSink : IVsInfoBarUIEvents
{
public void OnActionItemClicked(
IVsInfoBarUIElement infoBarUIElement,
IVsInfoBarActionItem actionItem)
{
ThreadHelper.ThrowIfNotOnUIThread();
if (actionItem is InfoBarHyperlink link && link.Text == "hyperlink")
{
// Handle hyperlink click
}
else if (actionItem is InfoBarButton button && button.Text == "Click Me")
{
// Handle button click
}
}
public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
{
// InfoBar was closed — clean up
// Important: Unadvise to prevent memory leaks
infoBarUIElement.Unadvise(_cookie);
}
internal uint _cookie;
}
// When subscribing:
var sink = new InfoBarEventSink();
uiElement.Advise(sink, out uint cookie);
sink._cookie = cookie;
KnownMonikers icons (StatusInformation, StatusWarning, StatusError).Unadvise to clean up event subscriptions (VSSDK approach) or handle OnClosed to avoid leaks.VS.InfoBar.CreateAsync() for the simplest in-proc solution.ToolWindowPane.AddInfoBar() when you own the tool window — it handles event wiring automatically.Do NOT use InfoBars for critical blocking operations — use a message box or user prompt instead. InfoBars are non-blocking by design.
Do NOT stack multiple InfoBars in the same window — consolidate into one with multiple actions, or dismiss the previous one first.
Do NOT use a global (main window) InfoBar unless truly IDE-wide — it causes layout shift. Attach to the relevant tool/document window.
Do NOT forget
Unadvise(VSSDK) orOnClosedhandling (Toolkit) — leaked event handlers accumulate memory.
Do NOT use
Process.Startfor InfoBar hyperlinks without validating the URL — never construct URLs from untrusted input.
VS.InfoBar.CreateAsync is valid. For VSSDK, ensure you're obtaining the correct IVsInfoBarHost — the main window host differs from per-tool-window hosts.ActionItemClicked handler (Toolkit) or IVsInfoBarUIEvents.OnActionItemClicked handler (VSSDK) is subscribed. For VSSDK, verify uiElement.Advise(this, out _) was called.infoBar.Close() (Toolkit) or uiElement.Close() (VSSDK) when the notification is resolved.What SKILL.md sets; muted values are Claude Code's defaults
41 skills in this plugin
/adding-codelens-indicatorsAdd custom CodeLens indicators that display inline information above code elements in the Visual Studio editor. Use when the user asks how to add a CodeLens indicator, show inline data above methods or classes, create a custom CodeLens provider, implement IAsyncCodeLensDataPointProvider, display git history or test status in CodeLens, or add a details popup to CodeLens entries. Covers VSSDK / VSIX Community Toolkit (in-process + out-of-process CodeLens service). VisualStudio.Extensibility (out-of-process) does not have a dedicated CodeLens API./adding-commandsAdd commands (menu items, toolbar buttons) to Visual Studio extensions. Use when the user asks how to create a command, add a menu item, add a toolbar button, register a command handler, wire up a .vsct file, use KnownMonikers icons on buttons, or place commands in menus/toolbars in a Visual Studio IDE extension. Covers VisualStudio.Extensibility (out-of-process), VSIX Community Toolkit (in-process), and legacy VSSDK (in-process) approaches./adding-context-menusAdd native-looking context menus to custom WPF UI in Visual Studio extensions (tool windows, custom tree views, list views). Use when the user wants to show a right-click context menu from their own UI that looks native to VS. Covers defining VSCT context menus (type="Context"), grouping commands with separators, and programmatically showing them via IVsUIShell.ShowContextMenu. Do NOT use regular WPF ContextMenu — it won't match VS theming or support command routing. Covers VSSDK and VSIX Community Toolkit (in-process). VisualStudio.Extensibility (out-of-process) does not support VSCT-based context menus on custom UI./adding-editor-adornmentsAdd visual adornments (decorations, overlays, highlights) to the Visual Studio text editor. Use when the user asks how to draw on the editor, add inline decorations, highlight text visually, add background colors to lines, show icons in the editor, create viewport-relative overlays, or render custom WPF visuals on top of editor text. Covers VisualStudio.Extensibility (out-of-process), VSIX Community Toolkit (in-process), and legacy VSSDK (in-process) approaches./adding-editor-classifiersAdd custom syntax highlighting and text classification to the Visual Studio editor. Use when the user asks how to colorize text, add syntax highlighting, create a classifier, highlight keywords, change text colors in the editor, create a custom language colorizer, or implement classification types. Covers VisualStudio.Extensibility (out-of-process), VSIX Community Toolkit (in-process), and legacy VSSDK (in-process) approaches./adding-editor-marginsAdd custom margins to the Visual Studio text editor (gutter icons, side panels, bottom bars). Use when the user asks how to add a gutter, editor margin, side panel, bottom bar, line number gutter, custom glyph margin, or editor chrome. Covers VisualStudio.Extensibility (out-of-process), VSIX Community Toolkit (in-process), and legacy VSSDK (in-process) approaches.Generated from the plugin's indexed repository (madskristensen/vs-agent-plugins) — no native marketplace selected
npx claudepluginhub p/madskristensen-vs-extensibility-skillsOther plugins' skills for the same job