The Visual Studio 2015 Preview
included many new features that enhanced the way developers work with
everything from the web and desktop to mobile apps. Several features
have had the spotlight, such as gesture support in the editor, Cordova
tooling, C++ enhancements and the new Android emulator. But there are
several other, less talked about features that I feel every developer that uses Visual Studio 2015 will benefit from. With that said, lets jump straight in!
Below is an example of switching between my Surface device and my Desktop Monitor. You will notice that with the Surface, I want to only show the XAML file whereas, with my large monitor, I want to see everything.

In this sample, it has determined that we included unnecessary “using” statements and helps remove them. Before doing so, you can generate a preview and have the changes affect the whole document, project or solution. While these features have appeared in JustCode and earlier versions of Visual Studio for years, we will be releasing a new version of JustCode for Visual Studio 2015 that will take advantage of Rosyln for enhanced productivity tools.


Go ahead and select the Visual C# Shared Project and create a class named

Notice that the only thing I had to do was reference the Shared Project.

Besides a updated file structure, you now have a folder called Dependencies that contains Bower and NPM. Generally speaking, you can think of Bower for client-side packages (such as jQuery and Angular) and NPM for developer tools (such as Grunt and Gulp). Both of these package managers are controlled by JSON files found in the solution.

Once added, you will see that we have the option to install/update or delete the package or view the homepage from the drop-down menu. This will come in handy as you are working with web projects.

In this sample, we added a watch on the breakpoint and added the following code:

Some of the notible features are :

Just after a few minutes of playing with the new Blend, I can tell Microsoft is committed to making the Blend experience similar to the Visual Studio one.
1. Custom Windows Layouts
This feature comes in handy if you develop on multiple devices. Say for example that you use a Surface Pro to develop on your train ride home and a 23″ monitor during the day. You can quickly switch between devices by going to Window -> Apply Window Layout and selecting one that you created earlier. They also have support for keyboard shortcuts so that you can quickly navigate to your favorite layout and the profile roams with you as long as you are signed into Visual Studio 2015.Below is an example of switching between my Surface device and my Desktop Monitor. You will notice that with the Surface, I want to only show the XAML file whereas, with my large monitor, I want to see everything.
2. Better Code Editor
The code editor has been replaced with “Roslyn” to give you a new and improved code editing experience. Light bulbs are shown when you need to include fixes to your code or refactor it. Whenever you see a light bulb appear, then click it and it will give you suggestions based upon the code it has analyzed.In this sample, it has determined that we included unnecessary “using” statements and helps remove them. Before doing so, you can generate a preview and have the changes affect the whole document, project or solution. While these features have appeared in JustCode and earlier versions of Visual Studio for years, we will be releasing a new version of JustCode for Visual Studio 2015 that will take advantage of Rosyln for enhanced productivity tools.
3. Shared Project – “All the Things!”
How many times have you wanted to use a Shared Project outside of a Windows Universal App? Now you can! After you open Visual Studio 2015 and search for “shared” then you will see the following:Go ahead and select the Visual C# Shared Project and create a class named
Person.cs and add the following code:class Person
{
public string FirstName { get; set; }
public Person()
{
FirstName = "Michael";
}
}
Create a new Console application and reference the Shared Project that we just created. Now you can write code such as :var person = new Person();
Console.WriteLine(person.FirstName);
Console.ReadLine();
If you run the console app, you will see it retrieved the FirstName
from our Shared Project. Go ahead and add a WPF or Windows Form
application and access the Person class like you normally would. This
also works for class libraries as well. After I’ve added several
projects, my solution explorer looks like the following:Notice that the only thing I had to do was reference the Shared Project.
4. IntelliSense for Bower and NPM
If you create a new ASP.NET 5 Web Project, you will notice several things that the new project template loads as shown below.Besides a updated file structure, you now have a folder called Dependencies that contains Bower and NPM. Generally speaking, you can think of Bower for client-side packages (such as jQuery and Angular) and NPM for developer tools (such as Grunt and Gulp). Both of these package managers are controlled by JSON files found in the solution.
- bower.json for Bower
- config.json for NPM
bower.json
file and add the package that we want. In this case, I want to add the
latest version of Angular without having to go to the Angular site and
manually download it and add it to my project.Once added, you will see that we have the option to install/update or delete the package or view the homepage from the drop-down menu. This will come in handy as you are working with web projects.
5. Debug Lambdas
Yes, the time has finally come where we can debug lambda expressions. Let’s take a look at the following code:List<int> elements = new List<int>() { 10, 20, 31, 40 };
// ... Find index of first odd element.
int oddIndex = elements.FindIndex(x => x % 2 != 0);
Console.WriteLine(oddIndex);
The console will return the value of 2. But what if we wanted to add a
watch and perform additional analysis of the expression as shown below.In this sample, we added a watch on the breakpoint and added the following code:
elements.Where(v => (int)v > 11).ToArray()
As expected, it returned 3 items that were greater than 11. This will
be a lot of help as you can use this in the immediate, and other
debugger windows as well. It is also supported in both C# and Visual
Basic.BONUS TIP!!! Blend for Visual Studio 2015 Actually Rocks
Blend comes with several enhancements but, by far, the one that was needed the most is the overhaul of the UI as shown below. You will quickly find that Blend includes most of the functionality that we have grown to love in Visual Studio.Some of the notible features are :
- Basic Debugging Support
- Peek in XAML
- Custom Windows Layouts as shown in feature #1
- Source Control
- NuGet
- and finally…
Just after a few minutes of playing with the new Blend, I can tell Microsoft is committed to making the Blend experience similar to the Visual Studio one.
No comments:
Post a Comment