I need to create a custom menu item for Visual Studio 2010 Add-in in C#, but I have had no luck in finding a solution for my needs.
I am aware that there was a similar post (Visual Studio Add-In - adding a context menu item to solution-explorer), but it did not help, as the blog follows the process through the integration package, and the video is done through VB. I had attempted to convert the VB syntax to the C# syntax, but about half way through the video, the Add-in methods has significantly changed from 2005 to 2010, as some of the methods have removed or changed.
Is there any good tutorials on making a custom menu item on the Solution Explorer in the lastest Visual Studio in C#, and is there a good website that could be used as a reference for looking over the VS add-in API? I've used Microsoft's main website, however it is confusing and wordy, which is difficult to understand and find the methods, properties, or commands that I am looking for.
Any help would be appreicated, Thanks in advance.
what are you writing? a number of cool add-ons already exist that might solve your problem..
such as vs 2010 Pro Power Tools
I don't know anything about it but you might want to check out MME MenuManagerTemplate and the sister project on CodePlex Managed Menu Extensions
Looks like the majority of the code is in the project on CodePlex so you could see how that project is implemented.
Related
In Visual Studio (2013/2015/2017), the Document Outline window for C# files is always empty ("There are no items to show for the selected document.").
It seems that this functionality is not (not yet / no more) implemented.
But then, how do I view the structure of the file? Is there any extension which implements this functionality?
showing only the selected/opened file
show regions
move/rename members
show documentation
Using the Solution Explorer and Class View are NOT the solution.
In the old Visual Studio 2003, I did use a self written Add-In, because it was easy to read the structure. (There were also other tools but I cannot find them anymore). So I ask here which solution you know. :-)
EDIT: Similar question also found:
How to show code outline in Visual Studio?
UPDATE: After 10 years the feature has finally arrived in VS 2022
This feature has been added in Visual Studio 2022 17.4.0:
You can now easily view a file’s structure at a glance in the Document Outline window. The Document Outline window displays the symbol tree of the file in the editor helping you quickly navigate and edit project files. You can open Document Outline by going to View > Other Windows > Document Outline or by using the shortcut Ctrl+Alt+T.
Update: This feature was disabled in v17.4.4 for the following reason:
After we released 17.4, we found some significant performance problems with the C# implementation of Document Outline that we didn’t catch during preview usage. We’ve temporarily disabled the feature, and are spending more time working on it to address these issues. These changes are larger than we’d usually like to include in a revision release, and need more bake time, so 17.4.3 [sic] onwards & 17.5 will both ship with the feature disabled. I know this is disappointing, but we have it back in no time and enabled in a future VS update.
There is also CodeMaid which provides the same functionality as JetBrains Resharper, but is free.
The best solution I found at present is:
JetBrains ReSharper (v8.0+) has a File Structure window which shows the structure of the current file as tree (types/members) and regions are also supported.
If you don´t have ReSharper, you can´t miss the Productivity Power Tools, made by Microsoft itself.
There's a specific version for each of Visual Studio versions. More info on these links:
VS2013
VS2012
VS2010
They have a feature called Solution Navigator
Also, there's this one that seems very interesting for bring alot of cool customizations to Visual Studio IDE, called VSCommands. It's worth to checkout their website => http://vscommands.squaredinfinity.com/features
It helps you look at the nested structure of certain types of files, e.g. windows forms designer file, open a form designer you should see all controls on the form shown in nested structure in the document outline window.
ide: vs 2012 v11.0.60610.01 update 3
project: web site, mix of vb and c#
problem: vb navigates to definition, c# navigates to metadata
complaint: complete pain in the ass when managing a 30k code-line project.
solution: you be the first to figure this out, it's beyond my level of patience.
i find metadata to be 110% useless.
is there ANY way to get c# to navigate to the actual definition like vb does?
thanks
If it's navigating to the metadata, rather than the definition, it probably has to do with how your assemblies were added. If you add a reference as a DLL, it will always show metadata, even if that project is included in your solution; you have to add a reference by project to have access to the source.
"i find metadata to be 110% useless. is there ANY way to get c# to navigate to the actual definition like vb does?"
Resharper's go to definition/go to implementation options work exactly as you'd expect - worth trying it to see if it fixes your issue.
This question might be of help if you choose not to try resharper
I realize this is an old thread, but it seemed to be one of the few that focused on the role of mixed languages (C# and VB.NET) as a contributing factor to this.
I ran a few tests across VS.NET 2010, 2012, 2013, and 2015. My empirical results (not validated by any official Microsoft documentation) is that all 4 support Find All References of VB.NET members consumed by C# (albeit, split into apparently separate result groups), as long as project references were added. However, VS.NET 2010, 2012 and 2013 end up in the "from metadata" view for Go To Definition from the C# code to a VB.NET member. Where as VS.NET 2015 appears to have this cross-language Go To Definition navigation working correctly.
I also confirmed that using Resharper's support for External Sources does allow Go To Definition to work under VS.NET 2012, and that almost motivated me to purchase licenses for Resharper for our current project that has mixed C# and VB.NET projects, but now my plan is just to expedite adopting VS.NET 2015.
I need to achieve some kind of extensibility for a custom project template.
Having a C# code file opened, if...:
...current project has some specific type id.
...code file is a class and inherits some concrete base class.
...user pressed F5.
...I'd like to...:
...start an arbitrary program (a console application).
...attach Visual Studio to the process of the arbitrary program.
...debug.
Actually I'm absolutely lost and I don't know how to do so. I know I need Visual Studio 2010 SDK, but I don't know how to create an extension doing what I need to achieve.
Thank you in advance.
UPDATE
I'm doing some research in Stackoverflow Q&A and I'll be adding questions related to my own one:
Visual Studio 2010 Extensibility - Override Build Action without effecting cproj file
"Attach to Process" as a post-build event (This seems fine, but I don't like the approach. I prefer a full Visual Studio integration. Anyway, it gives a hint).
I guess the best way to try is VS addin that will catch the Run (F5) command and handle it as you wish. See this article as a starting point for catching command from VS addin: How to: Add and Handle Commands. And these for attaching to process from VS addin Attach to process for lazies and Visual Studio Add-In To Automatically Attach to Development Server
Hope that helps to find a solution for your needs.
Do you consider the use of third-party extensions, for example, the free DXCore Visual Studio Extensibility Framework? It can do what you need.
First of all, thank you everyone for the info, it has been useful.
Basically I got the way to do what I'm looking to achieve.
Because I want to assist others in a similar situation, I'd like to share what I'm using to solve everything:
NRefactory as C# code parser. It works like a charm! You can get a lot of info from a code file.
VSPackage Visual Studio 2010 SDK project template.
In order to attach to a process I'm going to look forward for Dmitry Pavlov's suggestions.
Interesting links:
VSPackage how-to: http://msdn.microsoft.com/en-us/library/bb164715.aspx
As soon as I got everything working, I'm going to edit this answer and give more detailed info.
I made an application at the office which runs a bunch of ProcessManager objects which themselves run a bunch of Process objects.
I have been thinking in creating a wizard to create automaticly the classes needed, but I want now to create a custom designer for creating and editing the classes. By designer, I mean like the LinqToSql designer and so on.
I wasn't able to find any information about it, or at least clear one. I've been looking at how to create a new editor for vs 2010 or add design-time ability, but none of theses researches helped me.
The ideal would be to have let's say ProcessManagerClass1.cs and ProcessManagerClass1.designer.cs and when opening the first one, it would open the custom designer.
Do you know how to do it and give me some links for tutorials or documentation??
Thank you for your help,
Vincent
I would start with the Visualization and Modeling SDK for Visual Studio 2010, which was formerly known as the Domain Specific Languages SDK. It is the way to create custom designers in Visual Studio. To use it, you first have to install the Visual Studio 2010 SDK (SP1 here, but you may have to run them in order, which means this first, then the Visualization SDK, then SP1)
How do you create a desktop application using C# that would look like Visual Studio 2010?
Here's an example
What development environments can you use?
Can you recommend any samples, tutorials or blogposts?
edit:
I think I found what I was looking for... http://wpfthemes.codeplex.com/. Thank you all for your answers.
The video shows a plug-in for VS, but the basic answer is WPF.
I think the best approach is to do it the way Visual Studio does. Starting in 2010 the Visual Studio shell is a WPF application which has a very distinctive Win32 look and feel. I believe, but don't know, that a lot of this is done via styling and themes. So a simply WPF Application project would be the starting point of the solution.
Getting into applying styling and themes is beyond the scope of a simple SO answer. Could you be a bit more specific about what you want?