This is the third article in the series of the last Microsoft releases and this time I will focus on Visual Studio update – labeled ‘15.3’. I am usually easily pleased with most of the Microsoft IDE features so forgive me all of my ‘ohhh’ but I really love all this changes 😉.
No more ‘Add -> Existing Item’! ‘Drag & Drop’ will make the world a better place!
You know the struggle when you want to add a file to your project and you have to first copy it (physically) to the appropriate location and then in Visual Studio’s Solution Explorer pane, you have to make sure ‘Show all files’ is turned on, then click ‘Add’ in the appropriate folder, select ‘Existing item’… Yeah, I hated it too!
So now, all you need to do is just copy this existing file to the folder you want it to be attached and that’s it! Visual Studio will automatically refresh Solution Explorer content and will show the new file included! Even with the ‘Show all files’ turned off. I just love it!
What is more, you can still exclude a file from your project and of course it doesn’t affect the physical existence of this file. The information will be added to the .csproj file:
<Compile Remove="Controllers\TestController.cs" />
Cleaner .csproj file
Yep, .csproj file is pretty small now, containing only package references and some basic info about target framework etc. So what is missing? Microsoft got rid of paths to the included files… And you know what it means, right? No more silly merge conflicts to solve in .csproj! Isn’t it amazing?
A new refactoring tool to resolve conflicts
When you open a file with unresolved merge conflicts you can click a VS ‘lightbulb’ icon in the conflicted line and choose one of the tree options – ‘take HEAD / take upstream / take both‘. So, I guess, using git console will be more pleasant right now.
A new refactoring tool to automatically add null checking for method’s parameters
If you click on your method’s parameter and type Ctrl + . the ‘lightbulb’ that appears will offer you a few options – like ‘add null check‘ or ‘add “String.IsNuOrEmpty” check’ (for string variables) that will put the checking code into your method body.
Visual Studio suggests variables names
Have you heard that slogan: ‘that the hardest part of being a programmer is naming the variables’? Visual Studio comes here as a rescue and gives you a variable name suggestion basing on the type name. Of course, VS’s names are not very creative but the feature spares some unnecessary typing 😊.
More advanced ‘Go to’ window
You know, the small window that appears when you press Ctrl + T?
Now, it’s extended so you can select the type of content you want to go to. So start typing with one of the listed below signs and then type the searched phrase:
- t type_name
- # symbol_name
- : line_number
- ? – the help
- f file_name
- m member_name
Or just select the above options by just clicking the right icon:
Live Unit Testing available for .Net Core projects!
If you are not familiar with this feature let me provide a bunch of information. You select this option from the main menu (Test -> Live Unit Tests) and in the window of your .cs file you will see:
- red ‘x‘ sign for the lines that failed at least one test,
- green ‘tick’ sign for the line with all the tests passed
- blue ‘dash’ sign for lines don’t covered with tests.
When you hover mouse cursor over that signs you will get the tests count. If you click the sign, you will get the list of tests and if you click the name of some specific test, you will go straight to its implementation. So you don’t have to open additional windows to review the tests results.
Exception Window looks better
Well, that’s probably the first UI change in exception window since I remember (or there were some changes I forgot?) so let’s admit it – it was needed!
Indent guides in .cs files
The text editor of .cs files add some indent guides (dashed lines) that matches all the opening and closing brackets. When you hover over that line, the details of the block will appear – like namespace, class, method name and so on.
Featured image by Delaney Dawson