I'm toying with getting our team and projects ready for VS 2019. Right away, trying to set up Code Analysis for a new project, I find this:
So, if this is deprecated (and apparently can't even be used, so I'm thinking "deprecated" really means "gone"), where are we supposed to set up our Rule Sets? Is there some other location, or perhaps an altogether new solution to the problem of style and code quality?
Going forward, static analysis will be provided by Roslyn analyzers: https://github.com/dotnet/roslyn-analyzers
Migrate from FxCop code analysis to .NET compiler platform analyzers
Microsoft IntelliCode looks great!
Related
I am currently doing research to complete my org's migration to VS 2015, including implementing StyleCop.Analyzers, getting ReSharper settings updated and checked into source control, etc.
One topic I keep coming across is "compatibility" between StyleCop and ReSharper. A Jet Brains dev has even forked classic StyleCop in order to make it "compatible" with ReSharper 9.
What does "compatible" mean here? Is it as simple as making all of ReSharper's default code analysis settings match those in StyleCop, or something more involved?
Our upgrades/changes include:
Visual Studio 2010 to 2015
ReSharper 8 to 10
StyleCop classic to StyleCop.Analyzers
... so I just want to make sure I have my bases covered.
Is it as simple as making all of ReSharper's default code analysis
settings match those in StyleCop, or something more involved?
Yes, pretty much. It's all about keeping the rules in sync so that one doesn't flag an error the other is ignoring.
One thing to watch for on this migration is the version of the R# plugin. I haven't had much joy with ReSharper.StyleCop, but
StyleCop by JetBrains 4.8 works fine, plus it is designed to "play nice" with
StyleCop.Analyzers.
This is a new one for me. I have been asked, for legal reasons, to setup a laptop with Visual Studio, but to disable the ability to compile projects/solutions. The purpose is to enable browsing of the source code, but not allow building or executing it.
Yes, I know this is really a stupid question and unfortunately I can't get into too many details. I've asked about using alternative text editors, but I have been told no. So until I can prove it isn't possible (or that I have at least made a reasonable effort), I have to try and make this work. Notepad++ would be an excellent alternative, but that has been rejected.
This would be in Visual Studio 2010 or later. Is there any way that I can do this?
UPDATE
After trying Marius Bancila's suggestion of removing the compilers and MSBuild, I was surprised to find out that VS continued to work fine (except for building, of course). I did not expect that functionality like F12 (Go To Definition) would continue to work.
This may mean that there still remains the ability to build something somewhere somehow. But as it stands with MSBuild permanently deleted and the Visual Studio Build command not working, it'll take some effort to get around it (if a way in fact does exist).
You didn't say what projects should not be possible to build (VC++, VC#, VB.NET, F#, etc.). Starting with VS2010 they are all built using MSBuild. So if you delete MSBuild they will not be able to build from inside Visual Studio. However, one can still be able to build from the command line, so the only possibility I see is that you delete all the compilers that come with Visual Studio.
It's a little bit crazy, but if you really have to ...
Try deleting some important binaries after installing Visual Studio e.g. linker (link.exe) and compiler (cl.exe).
Use a text editor instead. Notepad++ even comes with color syntax highlighting.
You cannot prevent people from compiling the code. Visual Studio Express is available to anyone, and the compiler can be executed from the command line, without Visual Studio's help.
In Visual Studio is there an automatic way to search over file(s) and find all classes/properties/methods that aren't referenced. Essentially abandoned code.
I don't want to manually have to right click on each and select "Find All References"
This is not a feature of Visual Studio in the current version. Using Roslyn you could code and Inspector yourself, but Roslyn doesn't offer one out of the box either at the moment. The walk-through on Semantic analysis should get you started. The roslyn forum is a good place to seek help or find examples, and there's a well monitored tag on StackOverflow as well of course.
Productivity plugins like Resharper and Code Rush offer this for sure. There are other similar tools that might have this feature JustCode, VisualAssist, CodeItRight are likely candidates.
You can also use something like Visual NDepend to detect unused methods. Their new command Linq to Code features should make it relatively easy to build a commandline tool that fishes out all unused calls.
A bit late but if you install SSDT (Sql Server Data Tools) this also add grayed reference count to each method in visual studio.
Note: This is actually "code lens" which is no longer available for VS2015. Installing the SSDT is the way you can have "code lens" in VS2015.
I am trying to add support for a different language in Visual Studio 2010. I was hoping to add custom syntax highlighting, and have some sort of basic intellisense work with it. The language I am trying to add is 4Js Genero (a newer version of Informix-4GL). I basically just need support for the .4gl and .per file extensions that are used in Genero/4GL. Does anyone know how to do this, or can point me in the right direction?
It's not really for the faint of heart. Don't underestimate how much work you'll have to put in.
You'll need the Visual Studio 2010 SDK, and then to read (and re-read, and re-read(*)) all about Language Services
The purpose of a language service in Visual Studio is to provide language-specific support for editing source code in the integrated development environment (IDE). You implement a language service as part of a VSPackage.
(*) - unless it all immediately makes sense to you.
This isn't an answer on how to create custom syntax highlighting.
There is an open-source extension for visual studio 2010+ for Genero 4gl language support out of github:
https://github.com/gregfullman/VSGenero/wiki
It should do most of what you're looking for already, and it would certainly make a great starting point for you if you want to do more.
I am working on a C# windows based project in visual studio 2005.I often debug different features in this huge project.Now the problem is i have made few break points in few places which i require only when i debug for that feature.i want other break points to be disabled then.I understand this might not be a use case for larger community.
What i want to know is,is there any way to group break points in VS 2005 ,so that i can enable disable them when i debug that particular feature?
There's not a feature built into Visual Studio, however something I came across a while back is a clever use of macros to give some grouping functionality.
Check out this blog entry by Jim Gries showing how to do it.
Just a note, I now it doesn't help your current situation, but the situation has been improved in VS 2010.
you can check this reference:
a VS 2010 Debugger Improvements (BreakPoints, DataTips, Import/Export)
This solution works only in Visual Studio 2010 and above