Find all references recursively in visual studio 2013 - c#

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]

Related

VSIX extension to select class

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

Visual Studio 2013 Update 2 - Remove Project dropdown in C# navigation bar?

I recently updated my Visual Studio 2013 to Update 2 RTM. Now for my C# files, the navigation bar has a new dropdown for Projects, instead of just having Types and Members like it used to. The Projects dropdown is taking up valuable screen real estate.
Is there a way to hide that Project dropdown in the navigation bar?
See this link for a picture of what a navigation bar looks like.
Update: I added a picture of what my navigation bar looks like for a C# file.
I don't think as things currently stand that you can disable it, but its name is apparently "Context Switcher".
According to this MSDN blog, it would appear to be a new feature intended to help you manage shared files in Universal Apps. I agree that it's confusing, and I'm not a big fan.
A thorough search of the VS options for anything related to "Navigation Bar", "Context Switcher", or "Universal Apps" comes up empty and there don't seem to be any extensions offering this capability either. As far as I know these would be the main avenues for configuration, so my conclusion is that we are stuck with it until the next VS update or until someone gets around to making an extension that can disable it.
If you prefer, you can disable the navigation bar entirely in "Tools > Options > Text Editor > All Languages > Navigation Bar" (or you can disable the bar on a language by language basis.)
Update: As of Visual Studio 2013 Update 3, you can drag and adjust the relative sizing of the 3 drop down lists in the navigation bar.
From a little local testing it looks like the sizing you set is shared between all files and solutions and it persists after closing and reopening visual studio.
I shrank the context switcher down to just the visible text, and it feels more well proportioned and closer to the classic Class and Member drop down layout.
A specific issue has been opened at:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/5748900-add-option-to-exclude-the-new-shared-file-dropdow
Please vote !
In Visual Studio 2013 Update 3, which was released this week (http://www.visualstudio.com/news/2014-aug-4-vs) , we have added the ability to re-size the splitters in the Navigation Bar to your own taste. We will save this setting for you. This means if you don't want to use real-estate on the Context Switcher, you can make it very small, but without changing the keyboard behavior of the Navigation Bar. We hope you like this change, which will also appear in the next public release of Visual Studio "14".
There is no (official anyway) way to hide the project dropdown currently. We are considering it though.
Please file a suggestion on http://visualstudio.uservoice.com or file a bug on https://connect.microsoft.com to get your feedback heard.

Visual Studio extensibility

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

Resharper (Find and) fix all issues at once

e.g.
alt enter -> context menu -> Find all 'Redundant name qualifier' issues ->
but now in the new window that lists all those issues in my project, is there a way to fix them all ? (rather than go through them individualy)
ta.
For now, you have to go through the issues individually.
There's an existing request to batch-apply fixes to all similar issues selected in the "Inspection Results" tool window.
Code Cleanup does batch-remove certain issues in any given scope but it's quite limited in the number of fixes it can apply, compared to the number of code issues that ReSharper is able to detect.
Click into a redundant qualifier, alt+enter, then choose from the context menu that lets you fix the issue however thoroughly you'd like.
I'm running ReSharper 8.2.
Yes, you can use ReSharper's "Cleanup Code" to remove redundant qualifiers (amongst other things). This is available from the context-menu when you right-click files, projects and folders in the Solution Explorer window. Code Cleanup will run over all the selected files, reformatting and fixing common issues - it is also customizable.
This is available (in part) in the latest build. If you go to a specific issue in the code editor, click the lightbulb the fix option now has a submenu for some issues that can be applied to the entire solution. Would be cooler if it was available from the Code Issues window, but still a great improvement.
https://www.jetbrains.com/help/resharper/2016.1/Code_Analysis__Fix_in_Scope.html
No use for Resharper Just Go To Visual Studio
Analyze Menu
Code Cleanup Menu
Run Code ....tion
And Complate

Is there a utility that can monitor open windows/ in .net winforms?

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.

Categories

Resources