Extending Visual Studio
by Tim Anderson
Visual Studio 2015 is huge, so what scope is there for third-party extensions? We find out who’s doing what.
HardCopy Issue: 68 | Published: February 26, 2016
Visual Studio 2015 supports multiple languages for building Windows, mobile, web and cross-platform applications, and comes with tools for testing, modelling, profiling, refactoring and debugging your code. You could be forgiven for thinking of it as a comprehensive package, and in one sense it is. Visual Studio is the tool Microsoft uses to build Windows itself, so anything you can do on Windows, you can code in Visual Studio.
That said, there is a difference between what you can do, and what it is sensible to do. Creating your own Windows installer files, for example, is difficult and error-prone, and better done using a tool such as InstallShield, a limited edition of which is bundled with Visual Studio.
Creating a user interface is always challenging, and the controls that come with the package are basic. Developers who have the time and the design skills can customise them, but using a third-party component library is often a big time-saver with a better result.
Third-party components, unlike application-specific controls, are designed for reusability with consistent styling. Maintenance is easier since supporting the latest platform features when the operating system is upgraded, for example, is just a matter of upgrading to the latest version of the controls.
Another reason to look for third-party help is where you would otherwise need to write a large amount of code to solve a problem. If you need to parse or generate Microsoft Office documents, for example, you will have a substantial sub-project to work on, unless you use a pre-built component from a vendor such as Aspose, in which case you could have it done in an afternoon.
Debugging tools can also save time. Tracking down memory leaks can be difficult, for example, and despite the existence of memory profiling tools in Visual Studio, third-party tools like the ANTS memory profiler, SmartBear’s AQtime Pro, or the dotMemory tool that comes with JetBrains Resharper Ultimate, make .NET memory leaks easier and quicker to find. Such tools soon pay for themselves in increased productivity.
There is a downside to using third-party extensions and add-ons. Some components do more than you need, making your project larger than it could be, and occasionally an add-on can make Visual Studio less stable. However set that against delivering your project more quickly and with richer features than would otherwise be possible, and it is a small price to pay.
User interface components
Microsoft pioneered the concept of software components, and the availability of third-party user interface components goes back to the early days of Visual Basic. Today they are more powerful than ever, making it easy to build applications with rich charting, data analysis, touch and mouse friendly controls, and support for multiple platforms including Windows, mobile and web.
Telerik’s DevCraft is a bundle of 24 products mainly for .NET. Of these 14 are user interface components. Each product is also available separately.
Perhaps the richest control set is to be found in UI for WPF, which is one of the products bundled in Telerik DevCraft. The set includes GridView, ChartView, PivotGrid, a spreadsheet, RichTextBox with Word-like editing controls, Sparklines in imitation of a visualisation feature found in recent versions of Excel, layout controls including Book, Carousel and Expander, a PDF Viewer, and a ZIP compression library. WPF has received a boost following the release of Windows 10 and Microsoft’s recognition that desktop applications remain the core application type on Windows, and the framework is very much under active development. Touch support is also built into the controls, so tablet users are not left behind.
DevCraft also has strong mobile support. UI for Xamarin is a collection of controls for Xamarin.Forms, the most familiar way for Microsoft-platform developers to code for mobile, together with additional controls for iOS and Android such as AppFeedback, for user feedback, and DataSource, for binding data to controls such as ListView and Chart.
You do not have to use Xamarin if you want to use the Telerik mobile controls. DevCraft includes native controls for both iOS and Android.
Infragistics is a long-established component vendor whose controls cover Windows Forms, WPF, Xamarin, iOS, Android, ASP.NET and ASP.NET MVC, jQuery and HTML 5, and Silverlight. Infragistics also has an interaction designer called Indigo Studio, which lets you test and prototype designs and interactions.
Infragistics offers an Ultimate Developer Toolkit, which is a suite covering all its components and platforms, or you can go for separate platform-specific products such as Windows Forms, WPF, ASP.NET or Indigo Studio.
The Infragistics Windows Forms suite contains over 170 controls for Microsoft’s original framework for .NET Windows applications. These include Grid, Pivot Grid, Spreadsheet, Data Chart, Gantt View, Explorer and Navigation bars, Radial Menus and many more. A notable feature of the Infragistics suite is the inclusion of frameworks for working with common file formats including Word, Excel and Adobe PDF, so you can easily open or export those formats in your applications. These do not depend on Microsoft or Adobe applications themselves, so you can install without worrying about dependencies.
The same frameworks are also included in the Infragistics WPF suite, which is equally extensive. A notable feature of both suites is the inclusion of a Test Automation kit, which integrates with either IBM’s Rational Functional Tester (Windows Forms only), or HP’s Unified Functional Testing (Windows Forms and WPF). This means you can set up test suites and confirm that your user interface still works as expected as you maintain the application.
Flexera’s InstallShield has a long association with Visual Studio, and when Microsoft stopped including a simple setup project in Visual Studio itself, InstallShield was bundled instead. The Limited Edition, which comes with the commercial editions of Visual Studio, builds Windows Installer (MSI) setups and supports both 32-bit and 64-bit projects, Windows applications and services. The latest version supports Windows 10 as well as digital signing using SHA-256 code-signing certificates.
The Limited Edition is only intended for basic installations. Flexera offers both Professional and Premier editions for more advanced scenarios. You can upgrade an existing Limited Edition project simply by importing it.
Some of the features in InstallShield Professional are scripting support using InstallScript, custom actions to customise your installation, automation support so that you can trigger and control a build using a script, a user interface designer, and automatic upgrade support so that users keep up to date with the latest version of your application. It is also easier to manage dependencies, such as database or other required libraries.
The Premier version of InstallShield has important features for enterprise users, going far beyond the Professional edition. You can install multi-tiered applications, automate installing Windows roles, provision virtual machines, create Microsoft App-V installations (virtualised applications that have no dependencies), and localise installations with up to 35 languages.
In fact, the name is doubly misleading, because ReSharper today does much more than refactoring. Code quality analysis is a feature that inspects your code as you type, detecting issues and offering quick fixes where possible. Code generation lets you use a class, method, property or field before it has been declared, and generate the required boilerplate code. Code cleanup will remove redundant code and apply formatting according to conventions you set. Unit test support works with NUnit, QUnit and Jasmine unit tests, as well as Microsoft’s test framework. Resharper Build, new in the latest version, is a build tool optimised for large solutions. Quick navigation lets you jump to any file, type or code member immediately, or see all usages of a particular symbol and go to that code.
Another excellent tool is PostSharp, from the company of the same name. Originally an open source project, PostSharp automates the implementation of design patterns, such as logging, code contracts (preventing invalid inputs), thread synchronisation, and INotifyPropertyChanged (to implement the Observer pattern). However, rather than generating boilerplate code, PostSharp lets you annotate your code with attributes, so that your code is cleaner and more concise. “Boilerplate code is an anti-pattern”, according to a PostSharp white paper, because it causes code repetition, violating the ‘Do not repeat yourself’ principle of agile code.
PostSharp is not only a product with built-in design pattern implementation, but also a framework for creating new ones. Developers familiar with Aspect-Oriented Programming (AOP), which increases modularity by allowing the separation of coding concerns, will find that PostSharp provides an AOP framework for .NET.
Despite its name, PostSharp works with both C# and Visual Basic. It’s integrated into Visual Studio, and you add support to a project by deploying a NuGet package.
Software Quality tools
A buzzword of today is DevOps, which includes automating software delivery so that the path from developer to release is quick and agile. Automation requires robust testing procedures, increasing interest in software quality tools that prevent defective software from being released.
TestComplete from SmartBear is a platform for testing desktop, web and mobile applications. Tests are scripted using a choice of scripting languages, including Python, VBScript and C#Script. You can get started using record and playback features. A Test Visualizer captures screenshots along with details of what is being tested. Data-driven testing lets you use test data from a database rather than using hard-coded values, making tests more robust. You can manage and run TestComplete tests from Visual Studio 2015, and in the latest version you can integrate test cases with Microsoft’s Team Foundation Server for versioning and change tracking.
LoadComplete, also from SmartBear, is for stress-testing mobile and web applications. You can create tests using record and playback, and create tests which simulate multiple users. The tool is able to simulate different web browsers and connection speeds. LoadComplete is scalable beyond 30,000 users, and load tests can be distributed among virtual machines on-premises and in cloud environments. Detailed reports are generated.
Telerik’s Test Studio is a functional tool for testing web, WPF and Silverlight applications as well as web services. Test Studio includes a plugin for Visual Studio, so you can code tests in C# or Visual Basic. You can also use a visual recorder to build test scripts without writing code. In the case of web applications, you can use the same tests in Internet Explorer, Firefox, Chrome and Safari to check cross-browser compatibility. Test Studio also supports load testing, with the ability to schedule tests across multiple machines in parallel in order to stress the target application.
Enterprise Architect from Sparx Systems is a comprehensive application design and modelling tool that covers the journey from requirements analysis to design, implementation, test and maintenance, using industry standards including UML (Unified Modeling Language), SysML (Systems Modeling Language), BPMN (Business Process Model and Notation) and more. The tool goes beyond modelling to include simulation, debugging and profiling to verify the quality of your solution.
Enterprise Architect has a rich visual environment, letting you visualise complex applications. It can both generate and reverse engineer source code in programming languages including C, C++, C#, Java, Delphi, PHP, Python and Visual Basic.
Users of the Professional, Corporate or Extended Suite versions of Enterprise Architect can add Visual Studio integration using a product called MDG Integration. This lets you edit UML 2.5 models from within Visual Studio, including reverse engineering and generation of .NET code, and MDA (Model Driven Architecture) transformations. Reporting and document generation is also supported.
Parallel Programming is challenging, but also the key to applications that take advantage of today’s processors. Intel’s Parallel Studio XE is a full set of tools which integrate with Visual Studio to enable developers to build fast and reliable applications that take advantage of concurrent programming.
Parallel Studio is a suite of tools, offered in various configurations. The Composer Edition includes compilers for C, C++ and Fortran, a Data Analytics Acceleration Library for C++ and Java, a Math Kernel Library (MKL) for C, C++ and Fortran, Threading Building Blocks (TBB) for C++, and Integrated Performance Primitives (IPP) for image processing, data compression and cryptography.
These libraries are all optimised for concurrency, enabling developers to implement compute-intensive routines that take advantage of multiple CPU cores as well as CPU features such as SSE (Streaming SIMD Extensions) and AVX (Advanced Vector Extensions).
The Professional Edition of Parallel Studio adds Intel Advisor for vector optimisation and thread prototyping, Intel Inspector for thread debugging, and the VTune performance profiler for C++, Fortran, C# and Java. The Cluster Edition adds MPI (Message Passing Interface) libraries and tools for high performance on Intel-based clusters.
Debugging and optimising concurrent code is hard because it is non-deterministic. The exact order of code execution varies from one run to another, and some errors may occur rarely but often enough to be serious defects if they find their way into production. This means that pre-tested libraries that are easy to include in your code have a particularly high value.
When problems do occur, tools like Intel’s Inspector, which is able to find non-deterministic errors, are a huge time-saver. The kinds of problems it can find include memory leaks and corruption, illegal memory access, uninitialised memory reads, data races and deadlocks.
Intel’s Advisor is an innovative tool that addresses the hard task of how to find the best way to parallelise and vectorise your code. You can model different parallel designs, find data sharing issues, sort loops by potential gain, and analyse specific solutions.
Choosing your add-ons
Visual Studio is highly capable on its own, but use of extensions, libraries and tools such as those mentioned above can add great value to your development process. How can you tell if an add-on will be beneficial?
The short answer is that it is almost always more expensive to write new code than to use an existing tried and tested library or component, provided that the third-party resource really does what you require. This can be hard to discover, and few things are more frustrating than getting some way into integrating a third-party component only to realise that a missing feature, or occasionally a defect, prevents adoption.
The good news is that vendors are generally good at providing trials, and hands-on experience is often the best way to discover what will work for you.