Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8289735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:35:10+00:00 2026-06-08T12:35:10+00:00

This is similar to the following question: Visual Studio 2010 Plug-in – Adding a

  • 0

This is similar to the following question: Visual Studio 2010 Plug-in – Adding a context-menu to the Solution Explorer, however my query is how to add the item to the context menu item to the code editor window for JavaScript files.

I am attempting to add the context menu in with a Visual studio Add-in project (not a Visual studio package).

The code from the above link has been supremely helpful. To summarise, to add an item to the context menu of the Solution Explorer and Project explorer, we do so first by retrieving the items themselves:

CommandBars cmdBars = (CommandBars)(_applicationObject.CommandBars);
CommandBar vsBarProject = cmdBars["Project"];
CommandBar vsBarSolution = cmdBars["Solution"];

And later on, adding them adding them in by augmenting the readily available project template code:

command.AddControl(vsBarProject);
command.AddControl(vsBarSolution);

Now my query is regarding which of the cmdBars elements I have to add the command to, in order for my item to appear on the context menu for editing script files

I have already established its not cmdBars["Code Window"]. Is there one item for all files, or do I have to add it for each editor type (e.g. ASPX, Script, HTML, etc)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:35:11+00:00Added an answer on June 8, 2026 at 12:35 pm

    The context menu associated specifically with editing of Script files (and by association, JavaScript files) is cmdBars["Script Context"]

    In order to find this, I added the new menu item to all (465) menu controls in visual studio with the following loop

    foreach (CommandBar cc in cmdBars)
    {
        if (cc.Index >= 1 && cc.Index <= 465)
        {
            command.AddControl(cmdBars[cc.NameLocal]);
        }
    }
    

    I then narrowed this using a divide and conquer technique by adjusting the bounds of the loop:

        if (cc.Index >= 1 && cc.Index <= 256)
        ...
        if (cc.Index >= 1 && cc.Index <= 128)
        ...
        if (cc.Index >= 64 && cc.Index <= 128)
        ...etc...
    

    Until I eventually found what I was looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following question: Does Microsoft Visual Studio (I'm using 2008 SP1) offer
I have code similar to the following with a URL like this... If I
This is what I'm trying to do something similar to the following request, but
I have checked this similar question, but the suggestions did not solve my problem:
I found this similar question here , but this is really old. Was it
This is similar to this question, which is about a bash file . We've
I saw this similar question here but can't figure out how to use Contains
This is a follow-up to the following question: Executing ssh command in a bash
This has some lengthy background before the actual question, however, it bears some explaining
I'll preface this question with the note that I have looked at this similar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.