I want to develop an extension for Visual Studio 2017 which will allow user to right click on C# class and choose to invoke wizard from the context menu. I see here that it is possible with VSIX template. I also looked into Roslyn and feels that it might be the way to go forward but not sure. Basically I wan to select the class and read all it's properties hierarchically to show it in tree view and let user decide select from those. The point I am stuck at is if it is possible in Roslyn and can I use C# reflection there as well.
Thanks
Jay
Related
I have huge list of constants. I want show where this all constants are used in throughout solution. I can check this (using find in solution) one by one but it will take lot of time.
is their any way so I can achieve this very quickly ?
Regards,
Sachin
There is a complete list of Visual Studio Shortcuts available here https://msdn.microsoft.com/en-us/library/da5kh0wa.aspx. As already mentioned the default shortcut for go to Edit.FindAllReferences is Shift + F12.
Also if you rightclick a symbol in your code you can find the available actions in the context menu (+ hotkeys to use them) which may be easier if you are new to Visual Studio, because the list is quite huge.
"Find all references" is the easiest buit-in way to go, but that requires clicking through them one by one. "Find all references" can be accessed using the context menu or (by default) CTRL+K,R.
If you have VS2013 Ultimate and if your constants are in the same project or in the same file/class, you could use CodeMap. Right click on project/file and select "Show on Code Map". Or select Architecture-Generate dependency graph. This will draw you a graphical view of the usage. For example:
You can then filter this Graph by Project/Namespace/Class level.
Also, ReSharper has built-in analyzing features:
Here's some documentation about ReSharper's features.
May be you can try Alt + F12 [peek Definition]
In VS 2010, is there a way to see all the Methods in a docked window for the currently viewed class. Clicking the method would let me navigate to it.
This question is for design mode, while editing a class in the IDE.
I own Resharper, but don't see a way to see all the methods in a nice list as a feature.
If you have Resharper at your disposal as you indicate, you can use the File Structure window. It looks like this:
To open it, click Resharper, Windows, "File Structure". The window is dockable, and updates as your current file changes.
View -> Class View or Ctrl+Shift+C
You see the different classes on the top panel and the methods on the bottom panel.
Also, you have the method list on the top part of your tab:
You have VS 2012. This version has enancements in Solution Explorer.
If you expand a class file node you will see all classes.
And if you expand a class node you will see all its members.
See http://blog.wpfwonderland.com/2012/08/04/visual-studio-2012-tidbits-01-class-members-in-solution-explorer for an explanation.
Based on our project we created several item and project templates which after installation using our installer works perfectly. this was really good step as it avoids spending time on setting up new projects or modules inside our enterprise application. Now we want to move forward and create something similar to the context menu inside visual studio when u click Views or Controls folder inside ASP.NET MVC application and in other types of projects as well (for example when u click your right mouse button on your WPF application, under Add menu u get different items which avoids opening new window where u have to search for item time.
My goal is to create add in or whatever it is called to make it even easier to work with our SDK so for example when developer right-clicks on project we want to have our own menu items under New menu so developers will be able to add OURPROGRAM View, OURPROGRAM view with validation. can anyone assist me with this? or how provide good examples of this?
Look for the Visual Studio SDK documentation on MSDN.
There is an open source Iron Python project which is your best resource.
http://msdn.microsoft.com/en-us/library/bb165436(v=vs.80).aspx
Also on MSDN there is a walkthru for creating a basic project system.
http://msdn.microsoft.com/en-us/library/cc512973.aspx
This is a general question, but I'll explain my specific need at the moment:
I want to find the framework class that enables one to choose an image at design-time. I can find the editor that is used at run-time - its the Drawing.Design.ImageEditor. At design time, however, a different editor pops up which allows one to choose an image from resources.
I'm guessing I could run some kind of program, then open up the image editor, from the property grid, and see what new windows/classes have been created?
Thanks
Yes, you can see what's being used by using another instance of Visual Studio and use Tools + Attach to Process (managed) to look at the call stack. It is a Microsoft.VisualStudio.Windows.Forms.ResourcePickerDialog. That is not something you can use in your own code, the Visual Studio designer assemblies are not re-distributable. Nor would they be useful, they monkey with the design-time state of the project.
Making you own isn't that hard, just use Reflection to iterate the properties of Properties.Resources and find the ones that have the Bitmap or Icon type. Display them in a ListView to allow the user to pick one. Adding resources at runtime isn't an option.
A tool with similar functionality to what you mention is Spy++ which you can find in your Visual Studio folder on the start menu (under the sub menu Visual Studio Tools).
However, if I understand you correctly, I don't think the design time editor you're talking about is written in managed code and even if it was, I'm fairly sure it's not in the framework. It's just part of Visual Studio itself and as far as I know you can't get hold of the source code for that.
In Eclipse, when you are viewing a class (such as Java), there is a window available to list all the fields and functions of that class. Is there an equivalent for Visual Studio 2008 Pro, for C# (XNA)?
(I'm looking for an easy way to locate and jump between functions. Is there a better way to do this in VS?)
It's called the class browser in Visual Studio.
Go to View -> Class View
If you have ReSharper try ReSharper->Windows->File Structure Window
Yes: View + Object Browser. Click around a bit more to discover these kind of features by yourself, it's worth your time.
Sounds like the Object Browser. Click View-Object Browser.
You're looking for the Source Code Outliner Power Toy.
(source: 280z28.org)