Creating a plain C# Console App in Visual Studio 2015 Preview, we get a pseudo reference named "Analyzers":
What does the "Analyzers" reference just above mean?
The project file has nothing inside and the properties window shows nothing (completely blank) about this entry (though, in contrast to "reference properties" it says "folder properties" in the header, but that does not say much).
I would expect this to be related to Roslyn, but I have no idea. I have ReSharper installed, but I don't assume it has anything to do with it.
Edit 6.8.2016
The accepted answer explains the tooling provided by analyzers, but leaves open why a development tool becomes a (runtime?) reference. Actually it is not a runtime reference, unlike the other references. So the answer to this miracle is Hans Passants comment below:
They picked a clumsy place to add the code analyzers feature, they just couldn't find a better place without drastically overhauling the solution explorer and nuget. – Hans Passant May 26 '15 at 8:59
Live Code Analyzers are used to add custom error messages and warnings that appear live as you're typing, along with automatic code fixes to help you clean them up. They are available as NuGet packages that you add to your projects in Visual Studio 2015.
It is one of the best and helpful key new features of Visual Studio 2015 that lets a NuGet package enable custom warnings and errors in the editor live as you type the code, with automatic code fixes that can clean up those issues for us.
Packages can even be bundled together as a “code-aware library” that pulls in both an API and the domain-specific analyzers to make sure that you stay on course when using it.
We'll have a targeted guidance from the moment we download the NuGet package. And because these analyzers are part of our project, everyone on your team gets to see the same warnings.
Edit 1 :
Analyzers have rules attached to them like below :
These rules focus on the most critical problems in your code,
including potential security holes, application crashes, and other
important logic and design errors. You should include this rule set in
any custom rule set you create for your projects.
Currently there are a number of good Analyzers available – Microsoft.AnalyzerPowerPack, Code Cracker, CSharp Essentials, SonarLint etc
Each of these analyzers have their own rule set, so we can decide which analyzer to add, based on our requirements. Once installed via Nuget, the light bulbs and quick actions in VS2015 will pick up the associated rule set and provide the developers with coding assistance on the fly.
Related
I'm working on a Visual Studio solution using Visual Studio Professional 2017, the solution consists of four types of projects:
Several C++ projects
A C# project
Several C++ unit test projects
A C# unit test project
IntelliSense seems to be working for all, except for (at least) one of the C++ unit test projects, and it goes even further: for some tests inside that particular C++ unit test project, IntelliSense is working, but for some other, it isn't.
As mentioned in other Stackoverflow posts, I've already removed the *.cache files and there are no *.ncb files (so I can't remove them :-) ).
I also consulted the MSDN website, as proposed by Visual Studio:
Intellisense: 'No additional information available' (See 'Troubleshooting Intellisense in C++ Projects' for further help.)
I typed the mentioned sentence in MSDN search (learn.microsoft.com), and I got 229 results, which looked useless, and I got 0 results while searching for the exact phrase. :-(
Another approach : in my Visual Studio settings, I've maximised the messages, sent to the output window, I've rebuilt the whole solution, and afterwards I looked for the word IntelliSense in the output window. There was nothing. Then I typed something in order to launch IntelliSense, I verified the output window, but nothing was added.
In order to solve this problem, I need detailed information about IntelliSense itself:
I believe that IntelliSense is based on some files. Which ones?
I also believe that IntelliSense is keeping its own information in memory. Is this correct, is there a way to store this memory mapped information in files? If yes, which ones, and how can I force IntelliSense to refresh its information?
Whatever IntelliSense is doing (filling its information in memory, saving it in files, retrieving its information from those files, ...), what can I do in order to log those actions, so that I have an idea what might be going wrong?
In other words, does anybody have background information on the IntelliSense background task, which might explain what's going wrong, and how I can derive (from information in output window or other) what to do?
Thanks in advance
You can try resetting Visual Studio once
Devenv /ResetSettings
Sometimes Visual Studio has these gnawing bugs that just stresses you out for no reason.
Remove the hidden .vs folder from your solution. That would trigger index rebuilding.
Also you can try to install recent update for Visual Studio 2017, they seem to work actively on improving the indexing.
We've created a number of C# code snippets. If I import them directly using the Code Snippets Manager they work perfectly as intended.
Since we are going to have people rolling into our project at different moments in time we want to ease the on-boarding process so we want to include these snippets into a VSIX project. For that purpose I followed this process to the letter.
Now there are several issues going on:
1. When I run the VSIX in debug mode I get the experimental instance of visual studio but the scripts' folder is not in the manager and the package does not seem to be installed when I look in the "Extensions and updates".
If I close VS and run the VSIX installer, after re-opening VS I can see the package installed in "Extensions and updates", I can see the custom scripts' folder in the scripts manager and all the scripts are there but, when I open a code file and try to use them they are just not available, the short cuts are not recognized and the scripts are not available in the insert script context menu.
We have tried both approaches in three different environments and the behavior is the same.
We are using Visual Studio 2017 with .Net Framework 4.7.1
I have tripled checked all the settings, made sure there aren't any typos, all the files that need to be added are there in the right place so I do not know what else to check or try.
I am sorry that I do not include any code but there are some things that are deemed confidential but I tried doing it with the Hello World example and I got the same result.
Thank you for any help you can provide.
So as it turned out, there were multiple causes for this behavior.
Environment 1: With the brand new instance of Visual Studio 2017 there was a folder in the Snippets Manager named %LCID%. Within this folder there were two snippets specifically for MVC 4 applications. We do not know why but either these snippets or the folder was preventing our custom ones to be detected, once we removed this folder everything started working as expected.
Environment 2: This environment did not have the %LCID% folder but had ReSharper installed on it and it was configured to use the IntelliJ keyboard schema. As soon as we changed it to use the Visual Studio one then the snippets became available.
Environment 3: In this one the %LCID% folder was not present and the ReSharper keyboard configuration was set to Visual Studio. We disabled ReSharper and the snippets would still not be available. We basically were never able to figure out why the snippets were not available so we ended up going to the file system, cutting them from the custom folder and pasting them under the "My Snippets" default one and they became available.
Hopefully this information will be useful for someone or, even better, somebody might be able to explain why situations one and three would cause the snippets to not be available.
Okay, so, really quick question that I hope I can provide enough detail to get an answer for.
Programs used: Visual Studio 2015, Github
The problem is occurring whenever the developer makes a change that includes the references within Visual Studio and commits his changes to our Github. I am our tester and am told that the code is ready for testing, only to find that I cannot compile at times due to the Project References not being correct. We have discovered that this is because Github does not synch changes to the References that a Project has. The Reference that is giving us the most problems is an internal reference to another project within the solution, and appears in the "Shared Projects" section of the Reference Manager in VS2015. The developer is trying to soothe these issues as well, but our progress is being slowed significantly by this problem while he searches for an in-code solution.
Is there a way to force Github to add these Reference changes when making a commit? Due to the terminology used, I have not been able to find a solution to the problem anywhere, or at least one that I understood. I am not well versed in Visual Studio, so I am not sure if there is an option to change somewhere or another simple fix. If there is, please let me know.
I hope that I have provided adequate information without breaking my company's NDA. If you need further info to aid in this matter, I can ask the developer for further clarification, although it may take up to 24 hours for him to respond. Thank you in advance!
I have done a lot of searching around before asking this question. I am new to developing diagnostic tools and code fixes using Roslyn. I am currently using the Visual Studio 2014 CTP. I have been able to successfully create my first code fix tool. However, when I create another tool in a new solution, it still shows up the Description and fixes for the old diagnostic tool.
Can anyone please explain to me what I am doing wrong? I am rebuilding the solution before I test it out, and as far as I am aware, I am keeping both solutions completely separated. Or can anyone tell me how I can use multiple rules in one solution?
Building the .vsix project created by the templates will install a vsix extension into a special VS hive. These are not automatically uninstalled, so go to Tools | Extensions to uninstall them as necessary.
As SLaks mentioned, you can have multiple diagnostic projects in your solution, but you'll have to update the vsixmanifest in the vsix project to include this new project. If you want the multiple diagnostics to always be distributed together, then just put them in the same project (copy the class structure & exports from the sample).
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.