Visual Studio 2017: Display method references - c#

How can I display the references on top of a method declaration?
I looked for it in the Visual Studio properties, but could not find it.

In Visual Studio Professional or Enterprise you can enable CodeLens by doing this:
Tools → Options → Text Editor → All Languages → CodeLens
This is not available in some Community Edition versions

For display references on the top of method you have to enabled the CodeLens option in Visual Studio Professional and Visual Studio Enterprise.
Use below steps to enabled it.
1. Go to Tools and then select Options :
2. Then Select Text Editor -> All Languages -> CodeLens
3. Click on check box to Enable Code Lens:
Now you can see the references on the top of methods.
This will not work for VS - Community Edition.

No luck with Code lens in Community editions.
Press Shift + F12 to find all references.

CodeLens is not available in the Community editions. You need Professional or higher to switch it on.
In VS2015, one way to "get" CodeLens was to install the SQL Server Developer Tools (SSDT) but I believe this has been rectified in VS2017.
Still you can get all method reference by right clicking on the method and "Find All references"

For anyone who looks at this today after 2 years, Visual Studio 2019 (Community edition as well) shows the references

In previous posts I have read that this feature is available on VS 2015 community if you first install SQL Server express (free) and then install VS. I have tried it and it worked.
I just had to reinstall Windows and am going through the same procedure now and it did not work, so I will try again. I know it worked 6 months ago when I tried.

For anyone who is looking to enable this on the Mac version, it is not available. Developers of Visual Studio stated they will include it in their roadmap.

We can Go tools => Options => Text Editor => All languages => CodeLens to find the dialog box we need. After that, the reference can work normally.

Related

Re-enable title bar in Visual Studio 2019

I've downloaded the preview version of Visual Studio 2019 and the title bar is disabled by default.
This doesn't work for me as I currently develop C# applications using multiple instances of visual studio at a time, and I like knowing what window relates to which solution, and whether I am running with elevated privileges.
I've found that I can re-enable the title bar by going to the 'Preview Features' section in options, but this will obviously not be in the real release of Visual Studio 2019.
I've searched online, but have only found feature requests to not remove the title bar.
Is there currently any way to re-enable the title bar in VS 2019 (that is not related to the preview features option)?
It appears that some time around March 2019 the option to restore the title bar through a setting in the IDE was restored. I can confirm that the option remains in the latest release and preview versions of Visual Studio as of June 2019.
Go to:
Tools > Options > Environment > Preview Features
and untick
"Use compact menu and search bar (requires restart)"
Then click "OK" and restart Visual Studio.
If the setting gets removed again, it may still be possible to fall back to editing the file CurrentSettings.vssettings. Change:
<PropertyValue name="IsMinimalVsEnabled">True</PropertyValue>
to
<PropertyValue name="IsMinimalVsEnabled">False</PropertyValue>
Look for the file in %LOCALAPPDATA%\Microsoft\VisualStudio\16.0_xxxxxxxx\Settings\CurrentSettings.vssettings (where 16.0_xxxxxxxx will be the version you have installed).
The option can be found under "Preview Features" in Options. No idea why that got into the GA release.
Just unselect the compact menu option and restart VS.
In VS 2022, this setting has moved to Tools --> Options... --> Environment --> General.

Visual Studio Command Palette does not exist

I want to use Angular in Visual Studio. I have currently Visual Studio 2017.
I need to install something by using the command palette, but there is not command palette in Visual Studio. I used ctrl+shift+p or ctrl+p combinations, and then nothing happened. I also checked the View section, and there is no integrated command line section or anything else.
Visual Studio 2022 has a feature similar to a command palette, called QuickLauncher. You can open it by pressing Ctrl+Q by default or change the keyboard settings to use Ctrl+P, which is what I did for my setup.
(Default Shortcuts in Visual Studio)
Command pallete only available for Visual Studio Code, https://code.visualstudio.com/. You have installed the wrong one. For Angular development I highly recommend Visual Studio Code, not the full fledged heavy Studio 2017. Please use the link I posted above.
There is GoTo All(Ctrl + Q) option in visual studio which has similar features like file search, other interesting features for code navigation, some command execution like pull, start, run tests etc.
It's not exactly the one found in Visual Studio Code(Different IDE), its getting pretty close with time.
For example there are many missing like 'start current page application' which can set in Tools -> Options -> Keyboard.
There is a ticket raised for Visual Studio to implement this feature long back and it seems it had been considered by Visual Studio team.
https://developercommunity.visualstudio.com/idea/460947/command-palette.html

How does one start a WPF Project in Visual Studio 2013 Express for Web?

I'm struggling with something very fundamental - so I'm probably being dumb.
I'm following the MSDN Tutorials for learning Visual C# and one of the very first things you do (following changing the theme color, of course) is create a new project. The project template(s) listed, specifically "WPF Application", are not existing, however.
Here's what the tutorial says I should see:
The same process is used by this tutorial.
What I see lacks "WPF Application"
Uhh.... what? When I use the search box for "WPF", I find "WPF App for MVVMbasics Core project" which I have to download from online, but get this error message when using it:
Can anyone help?
The give away is in the title of the dialog box displayed when you try to open a WPF project (my emphasis):
Microsoft Visual Studio 2013 Express for Web
The Express products each only support a subset of the project types. Choose "Express 2013 for Windows Desktop" from the Visual Studio Express page. Alternatively, if you meet the "Who can use Visual Studio Community" requirements at the bottom of the page, you could download Visual Studio 2013 Community.
Try Changing from .Net Framework 4.5 to 4.0 or 3.5 from the comboBox above.
If that solves, then you may need to install .Net Framework 4.5 on your system.
And if not, run the Visual Studio Installer again. Will be better to remove and install again than just using 'Repair' option in the installer.
Select 'Full' option on components selection if it asks for while installing..
Reinstallation would defenitely help. But if you don't like to spend that much time.. Take a look at
https://social.msdn.microsoft.com/Forums/vstudio/en-US/8a5ae9e3-be7b-493d-831c-1e49e8103f26/visual-studio-project-templates-are-missing?forum=vssetup

I have Visual Studio for my Business Intelligence tools, how do I add C# to it?

Excuse the ignorance, but I've been a BI/SQL Developer all my life, and recently have been more interested in getting better with C#, I thought I'd fire it up and start playing with it. I thought it was supposed to be included in my Visual Studio package that I have for BI, but when I go to File > New > Project, a New C# project is not something that is available there. How do I add it?
Run the VS installation and add the required components, assuming that your VS package has them.
Your best bet would be to reinstall a professional or premium version of VS. When you install select that you want all the packages so you can program in C#, VB, C++ ect.
here is a link to VS: http://www.visualstudio.com/
This link is a direct download link to a VS_Professional version download from the website:
Vs Professional download link
You can't unless you install the correct version of Visual Studio.
But you can try instead the new Visual Studio 2013 Community with Update 4
It is the latest IDE completely free with no license required that includes all the tools including C# development

Working with Unity3D and Visual Studio 2013

how do i get Unity3D for debugging the code, and Visual Studio 2013 which i have now to only script the code. Example: Like Flash Professional for debugging and FlashDevelop for scripting only.
My question is, how do i get the Unity3D link with Visual Studio 2013. I already searching around the internet, and had found that Unity3D only works with VisualStudio 2010.
I wrote a blog article on this awhile back on my blog HERE for Visual Studio.
However I will paste it here too:
How to use Visual Studio 2013
Recently Microsoft bought and re-released the popular Unity3D plugin UnityVS. The now renamed Visual Studio Tools for Unity plugin smooths the connection between Unity and Visual Studio and even allows one to perform debugging too! Download it here.
In Unity Editor go to Edit->Preferences->External Tools and In External Script Editor choose Browse from the drop down box.
Browse to and select C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.
The External Script Editor should automatically show your selected editor as Visual Studio 2013.
That’s it! It should just work from that point on.
As an important update, I would like to notice, that former UnityVS (after Microsoft's acquisition of SyntaxTree) is now available for free as a rebranded Visual Studio 2013 Tools for Unity.
The versions for VS 2012 and VS 2010 are also available.
The integration of Unity3d and Visual Studio got simpler with latest Unity (version 5) and Visual Studio Tools. This is the current procedure.
To use Visual Studio as editor and debugger with Unity you must:
Install the Visual Studio Tools For Unity. For this download the package at http://unityvs.com (careful to get the version for the Visual Studio you are using) and import it (as is standard in Unity for packages) by going into Assets -> Import Package -> Custom Package and browse to the tools installation folder and pick the package.
Once installed in Unity you will get an additional menu Visual Studio Tools, go there and select "generate project files". Visual Studio will already be the default editor for your scripts.
This done, if you say put a breakpoint in Visual Studio, click on "Attach to Unity" in Visual Studio, and then run your Unity project, the process will stop at breakpoints in Visual Studio and allow variable inspection etc.
you can use unityvs VS plugin (but I'm not sure about current 2013 support, it's works with vs2012) http://unityvs.com/ - on windows it's works very well, but remote OSX debugging feature is not ready yet
I'd like to add to the fine answer given by Pietro Polsinelli, that for me, there was an extra step in his Step 1. And that is that, after installing Visual Studio Tools For Unity, I had to, in Unity, go to Assets->Import Package->Visual Studio 201X Tools and then click around on the menu bar until "Visual Studio Tools" showed up as an option. After that, I could Generate Project Files and Open in Visual Studio.
This enabled me to Attach to Unity in Visual Studio and debug.
None of these solutions worked for me. Renaming monodevelop just changed the default program to notepad++, and the next default program after that was simply notepad.
However, there is a known bug with Visual Studio 2013 (not sure if it was present in previous versions, or if it is present in the non-professional version) where if you try to open a C# file in visual studio, where Visual Studio is opened as administrator and Unity isn't, VS crashes.
I had to either run both programs (VS and Unity) as administrator, or not open VS as administrator (as per the solution found here: http://connect.microsoft.com/VisualStudio/feedback/details/597863/cannot-open-visual-studio-files-from-windows-explorer).
With Visual Studio You Can Use UnityVS Plugin But if You Use Monodevelop You Can Go To Run->Attach To Process.. And Connect The Debugger to Unity Editor It Work Perfectly.
To link Unity with Visual Studio, do the following:
Do this on Unity.
Go to file --> preferences --> external tools --> external script editor --> Choose visual studio.
If Visual Studio is not showing, you Re gonna have to browse Visual Studio by hand.
Then you open any script in the Unity Project window and Visual Studio should open the file.
I hope this is helpful.
Note that I am using Unity 2020.2 and Visual Studio 2019

Categories

Resources