Visual Studio 2015

by Tim Anderson

The latest version of Visual Studio aims to be all things to all developers. Tim Anderson finds out what it’s got to offer.

HardCopy Issue: 67 | Published: November 6, 2015

Microsoft’s platform is changing, and Visual Studio, the all-encompassing development tool, is changing with it. This release is shaped by several key trends.

The first is Windows 10, which has been rolling out to customers – in many cases as a free upgrade – since the end of July 2015. Windows 10 is Microsoft’s effort to deliver an upgrade that Windows 7 users will enjoy, unlike its predecessor, but it is also a step forward for the secure and touch-friendly Windows Runtime platform which Microsoft introduced with Windows 8. The Universal Windows Platform (UWP) is the next step in its evolution and runs on desktop Windows, the forthcoming Windows 10 Mobile, XBox One consoles, and a new edition of Windows called IoT Core that runs on small devices such as the ARM-based Raspberry Pi.

The UWP offers several advantages to developers, including the simplicity and discoverability of deployment through the Windows Store, and the possibility of having an app work across numerous form factors including mobile. In Windows 10, UWP apps run in a window just like desktop apps, making them more familiar for users.

Windows desktop apps remain important, particularly since it is easy to write applications that run on all versions since Windows 7, or even back to Windows XP. Visual Studio has several options for building desktop applications, and in this version there are improvements to Windows Presentation Foundation (WPF), which is the primary framework for desktop development in .NET. The Visual Studio IDE itself is built with WPF. Other options include the older Windows Forms framework and Visual C++ with Microsoft Foundation Classes (MFC) or other frameworks.

Second, there is Microsoft’s cloud platform, Microsoft Azure and Office 365. Although Office 365 is mainly a set of hosted applications, it is also a development platform, exposing APIs that you can use in cloud or mobile applications, and using Azure Active Directory, which you can also use for custom applications. Businesses benefit from single sign-on and a unified directory.

With or without Office 365, Microsoft Azure is a comprehensive platform, ideal both for test and development and also for deployment of cloud applications running on either Windows or Linux. Azure services include database management, analytics, virtual networking, auto-scaling web applications, and Visual Studio Online for application lifecycle management. Azure also provides services for processing input from large numbers of sensors, as in a typical Internet of Things (IoT) application.

Visual Studio 2015 has deeper Azure integration than before, with easy creation and deployment of ASP.NET applications to Azure, and new Azure-based diagnostics through a feature called Application Insights.

Visual Studio 2015 Screenshot

This is what the Visual Studio 2015 development environment looks like.

 

Building Universal Apps

Despite small improvements to the desktop tools, the main focus of the improvements for Windows developers are in Universal apps. These offer developers a number of advantages. Deployment is usually from the Windows Store, and users get updates automatically so complex setup routines are not needed. Customers can discover apps more easily, thanks to Store search which is built into Windows 10. Business apps can be deployed via the Business Store, a forthcoming feature that lets businesses assign apps to users so they receive them automatically. UWP apps are also safer for the user, making them more likely to be installed.

In Windows 10, UWP apps run in a desktop window, unlike Store apps in Windows 8, and the user does not need to know whether a particular app is desktop or universal.

Developers, on the other hand, will be keenly aware of the differences. A UWP app behaves more like a mobile app than a desktop app. It is sandboxed from the operating system and from other apps, and can access only a subset of the Windows API. Data is normally retrieved over the internet.

The Universal Windows Platform diagram

The Universal Windows Platform gives developers the tools they need to target many device types from a single code base.

The application lifecycle is different too. A desktop app is either running or not running, and even when minimised can run in the background. A UWP app on the other hand has a third state, called Suspended. In this state the application remains in memory but code does not run, unless you specify background tasks. A suspended app can also be terminated at any time, so you must handle the Suspending event to save your application state, and restore it in the Resuming event.

Another key difference is in the user interface. A UWP app is generally designed to be touch-friendly, though users with keyboard and mouse should still be well supported. If you use XAML to build your application, the built-in controls are chunkier than typical Win32 controls for this reason, and are designed to support both touch and keyboard/mouse interaction.

 

Cross-platform support

Another major theme is cross-platform support. Previous versions of Visual Studio have focused mainly on Windows when it comes to mobile, though Apache Cordova made an appearance in Visual Studio 2013 for building cross-platform apps with HTML and JavaScript. In Visual Studio 2015, this is joined by deep integration with Xamarin’s tools for building iOS and Android apps with C#, as well as C++ compilers for Android and for Apple’s iOS. Games developers can use C# and the third-party Unity toolkit to compile for several platforms including Android and iOS as well as Windows. A Hyper-V based Android emulator comes with Visual Studio.

The cross-platform story does not end there. Visual Studio 2015 also supports .NET Core, a new version of Microsoft’s managed runtime that is both open source and cross-platform, running on Windows, Mac and Linux (see below). This means that you can now deploy ASP.NET applications on platforms other than Windows using Microsoft’s official tools.

Visual Studio also has better support for non-Microsoft languages. In addition to first-class support for JavaScript and JSON, you can install Python Tools and Node.js tools to enable intelligent editing and debugging for these popular web development languages.

The rationale for these cross-platform efforts is that Microsoft is no longer relying exclusively on Windows for its future growth. Windows Phone has never taken off, and mobile developers need to support iOS and Android. Microsoft’s strategy is to make it easy to create apps for these platforms that use Microsoft cloud services, just as it has provided versions of Microsoft Office for iOS and Android in order to promote Office 365.

Microsoft’s languages have also been updated, and Visual Studio 2015 comes with Visual C++ 15, C# 6.0, Visual Basic 15 and F# 4.0. Visual C++ 15 has better standard compliance, including improved C++ 11 support, some C++ 14 support, and preliminary support for some C++ 17 features. In addition, Microsoft claims to have fixed over 500 compiler bugs. The C++ editor now supports refactoring.

The .NET compiler has been rewritten in managed code (the project codenamed ‘Roslyn’) and this enables new editor features including enhanced refactoring for C#, refactoring in VB for the first time, and live code analysis and fixes as you type.

A new feature called IntelliTest can generate test data and unit tests for .NET code, speeding development time.

 

Changes to .NET

The new .NET Core is the biggest change to .NET since its introduction in 2002. It is also potentially confusing, so a quick overview is in order.
With this release, Microsoft has forked .NET into two streams. On the one hand is the .NET Framework, now at version 4.6, which is the latest release of the familiar .NET platform. This is a system component and works on all versions of Windows from Vista upwards. On the other hand is .NET Core, a new more modular framework designed from the ground up to be cross-platform – so new that Visual Studio 2015 is released with a preview version of .NET Core as, at the time of writing, neither the tooling nor the runtime and libraries are complete.

Microsoft developed .NET Core with two specific purposes in mind. One is .NET Native, true native compilation for .NET code, which is used for the Windows 10 UWP. According to Microsoft, it would not have been possible to implement .NET Native without refactoring .NET to be more modular, enabling the compiler to strip out everything that is not used by the application. The other is the latest version of Microsoft’s web application framework, namely ASP.NET 5.

The company also made the decision to make .NET Core open source, making all its source code available on GitHub. The project is among those managed by the .NET Foundation, whose directors are Miguel de Icaza, responsible for the Mono project (open source .NET) and co-founder of Xamarin (.NET for iOS and Android); Gianugo Rabellino from Microsoft Open Tech and the Apache Foundation; and Jay Schmelzer, Director of Program Management for Visual Studio.

Why bother with .NET Core when Mono has existed for years? The answer is that unlike Mono, .NET Core is supported by Microsoft and much of the code is shared with the .NET Framework and its libraries. Both projects will continue, but with increased cooperation. Mono will also benefit from access to .NET Core code.

The .NET Core project does not cover desktop applications such as those built with Windows Presentation Foundation (WPF) or Windows Forms. The reason is that these frameworks have too many Windows-specific dependencies. Mono on the other hand does support desktop applications. Since it is open source, it is also possible that other GUI frameworks based on its code could be developed in the future.

In the case of .NET Native, the use of .NET Core is invisible to the developer. Visual Studio ensures that your code is compatible. Applications benefit from faster start-up time and in some cases improved performance, thanks to full native code compilation.

ASP.NET 5, on the other hand, is compatible with both .NET Core and the .NET Framework. On Windows, the developer can choose which runtime to use. Cross-platform ASP.NET 5 must use .NET Core.

One of the key differences when an ASP.NET 5 application is deployed on .NET Core is that the runtime is deployed with the application, rather than having a dependency on a system component. This approach means there is less risk that an operating system update will break the application. Another implication is that those developers working on the framework itself have a little more freedom to make changes without breaking deployed applications. The downside is that servicing is harder since you cannot rely on operating system updates if, for example, a security problem is found in .NET Core.

.NET Core diagram

.NET Core is a fork of the .NET Framework, used for ASP.NET 5 and Universal Windows Platform apps.

Microsoft has said it will come up with solutions to the servicing issue but it is not yet clear how this will be handled.
There are two parts to .NET Core. The runtime is called CoreCLR, and the core libraries CoreFX. Both are distributed through NuGet, the package manager built into Visual Studio. Applications are deployed with only the libraries they need, and the componentised design for CoreFX means that unnecessary code is kept to a minimum.

All .NET applications need a runtime layer that hosts the Common Language Runtime (CLR) and bootstraps the application. Microsoft has developed a new cross-platform runtime host called the .NET Execution Environment which is designed for ASP.NET 5 but can also be used for console applications. The .NET Execution Environment (DNX) also includes tools for installing, creating and managing NuGet packages, so once DNX is installed you have all the essentials for building and running .NET applications. DNX can even use the .NET Framework instead of the CoreCLR, so it is consistent.

Once DNX is installed you can use the .NET Development Utility (DNU) to manage NuGet packages or package an application for deployment. For example the command ‘dnu restore’ will find the application dependencies, listed in a JSON configuration file called project.json, and download them. The command ‘dnu build’ will generate output for deployment, including the DNX runtime for executing the application.

Another key tool is the .NET Version Manager (DNVM). Installing DNVM is the first step in setting up a .NET Core development environment. You can use DNVM to install and upgrade DNX.

Microsoft also has a simple cross-platform development environment in the form of Visual Studio Code, based on Google’s Chromium runtime. Using Visual Studio Code with .NET Core you can develop, build and deploy ASP.NET applications on a Mac or on Linux. Git support is built in, and you can use Git’s push command to deploy and update applications, for example those hosted on Azure.

The .NET Core project is a huge transition for Microsoft and full of potential. We could, for example, envisage a future update to Visual Studio 2015 that lets you select between Windows, Mac and Linux targets when using the Publish wizard for ASP.NET 5 projects.

However there are two things worth emphasising. The first is that the .NET Framework is not going away. ASP.NET 5 runs on both the .NET Framework and .NET Core. Secondly, .NET Core is still in early preview (UWP apps aside). It is not yet a viable option for production, and the speed at which it evolves depends on open source community involvement as well as Microsoft’s own efforts to make cross-platform .NET a reality.

 

Licensing

Your licensing options with regards to Visual Studio 2015 are complicated and, unless your needs are very straightforward, you are advised to speak to a Microsoft partner such as Grey Matter to ensure you don’t pay more than you need.

That said, in most situations the best way to obtain Visual Studio 2015 is to purchase an appropriate MSDN subscription for each intended user. This will come with Windows, Windows Server and SQL Server, together with a licence to use Team Foundation Server, as well as a level of technical support and e-learning that depend on the Edition you choose.

Of the four MSDN subscription options, three come with Visual Studio:

Visual Studio Professional with MSDN is the core Visual Studio edition and comes with all the tools you need to build Windows desktop, Windows Store, Windows Phone, web and cloud applications, as well as Universal Windows Apps, in a variety of languages. Unit testing is included, as is access to Microsoft Azure and Visual Studio Online.

Visual Studio Test Professional with MSDN does not include development tools but is instead aimed at test specialists and comes with test case management tools including Lab Management for testing distributed applications, and more comprehensive support for Visual Studio Online. However it does not include load or web performance testing, which are reserved for the Enterprise edition.

Visual Studio Enterprise with MSDN adds the full range of Microsoft server products, together with Office Professional Plus which can also be installed on one device for production use, and a Developer Subscription to Office 365. Tools exclusive to this edition include code coverage and review, web load and performance testing, IntelliTest, coded user interface testing, Lab Management, full Team Foundation Server with sprint planning and backlog management, and the full range of architectural and modelling tools. If you currently have a Premium or Ultimate edition then you will be automatically converted to the Enterprise edition.

Visual Studio Blend

XAML is the layout language used by the UWP, WPF and Silverlight, and Blend is the XAML designer that comes with Visual Studio. This has been redesigned, with a new streamlined user interface and XAML IntelliSense. XAML debugging means you can inspect the state of the XAML ‘visual tree’ at runtime.

Blend uses the same project format as Visual Studio, and you can open a XAML file in Blend simply by right-clicking the file from within Visual Studio. There is a XAML visual designer in Visual Studio itself, but Blend has several advantages in that you can create animations visually; convert shapes and text into paths that can be reshaped; use behaviors (snippets of code) to add interactivity; import artwork from Adobe PhotoShop or Illustrator; and visually modify controls templates and styles.

Although Blend is a separate application, you can work on the same files seamlessly using both Blend and Visual Studio. However Blend is a more designer-centric tool and easier than Visual Studio for those with design experience. Developers who are familiar with in-depth XAML coding may prefer to work in Visual Studio.

Visual Studio Blend

Alternatively, if you are not interested in collaborative development, targeting Microsoft Azure or facilities such as load testing, then you can purchase a retail licence to Visual Studio Professional itself, or download Visual Studio Community or Visual Studio Code 2015 free of charge which allow you to build non-enterprise applications.

MSDN and Visual Studio licences allow a single user to install and use the software on any number of devices, but only for the purpose of designing, developing, testing and demonstrating the project they are involved in, so each member of your team will need a separate licence. Note that this limitation applies to all the software that comes with an MSDN subscription, so you need a separate licence to any of the server products if you use them for anything other than software development.

If you want to work with Team Foundation Server then you need Windows Server and Team Foundation Server licences for each server installation, plus both Windows Server and Team Foundation Server Client Access Licences (CALs) for each user. A server licence and the necessary CALs are included when Visual Studio is bought with any of the MSDN options, but not with the stand-alone licence that comes with the retail version.

A retail version of Team Foundation Server comes with five CALs. There is also a free Express edition that supports up to five users, but with some restrictions and no SharePoint integration.

Visual Studio Online is a subscription-based service that is charged per user per month, with the first five users free of charge. A licence to access Visual Studio Online is included with all editions of Visual Studio 2015, with the exception of the Community edition. In addition, any number of users, sponsors and other stakeholders can have limited access to a Visual Studio Online account for submitting feedback, entering and editing work and backlog items, and suchlike.

Access to Microsoft Azure is included as part of Visual Studio Professional with MSDN, with increased levels of service as you move to the Enterprise edition, and this can be used to run production applications as well as for development and testing.

All of the MSDN options that include Visual Studio 2015 can also be purchased through any Microsoft Volume Licensing programme. Stand-alone licences to Visual Studio Professional can be bought retail or through the Open programme, and there are special options for government, educational and academic use, and for software start-ups.

Note that a conventional MSDN subscription gives you ‘perpetual user rights’ which means you can continue to use it after your subscription has expired, although you will no longer receive updates or have access to the download site should you need to reinstall (so make sure you keep copies of the installation files and keys). However this is not the case if MSDN is bought as part of a Volume Licensing scheme where your right to use the software expires with your subscription.

Current customers with active MSDN subscriptions can download the version of Visual Studio 2015 appropriate to their subscription from the MSDN website.

Find Out More

This is a big release of Visual Studio, encompassing major changes to the .NET platform and reflecting the importance of cross-platform web and mobile for today’s developer. This article can only touch on some of those changes, which is why we have created a special website to cover the features of this powerful tool in more depth.

See www.greymatter.com/hc/visualstudio2015 for more details.

ISV Royalty Advert
HardCopy 69 ad