Microsoft's second preview of Visual Studio 2019 16.5, freshly flung out this week, has better Linux support for C++ developers and also includes a new designer for Windows Presentation Foundation (WPF).
Visual Studio is updated every two or three months. Version 16.4 was released in early December so you can expect 16.5 to move out of preview in February or March. The new preview is not supported for production use.
Linux development with C++ is supported in Visual Studio 2019, using either a remote machine or Windows Subsystem for Linux (WSL), and Microsoft is improving its integration with WSL to make this a smoother experience. Since WSL can easily access the Windows file system, there is no need to set up a remote connection. You can simply edit the project files in Windows and build them on Linux. You can use either CMake or MSBuild.
There is a snag, though, which is that WSL is command-line only. New in 16.5 is the ability to build on WSL but deploy and debug on a second remote Linux system over SSH.
There is also a new optimisation for the case when you are building and debugging remotely. Visual Studio is smarter about synchronizing source files, using SFTP alongside the rsync utility, and according to this post about the new version, the result can be dramatically quicker – such as two seconds rather than over three minutes to start debugging.
Developers using CMake can now also enjoy editor features like Go To Definition and Find All References in CMake scripts.
Design for living
Over in the .NET World, Microsoft is busy enabling developers to use .NET Core everywhere rather than the old .NET Framework. Using .NET Core 3.x, you can now develop WPF (Windows Presentation Foundation) and Windows Forms applications. There are still a few kinks to straighten out, though, one of which is the need for new visual designers.
The XAML designer for WPF .NET Core was made generally available in December 2019. In the new 16.5 preview, you can now use this designer for .NET Framework apps as well, with claimed performance improvements. The Windows Forms designer for .NET Core is still in preview, though. Note that despite the cross-platform nature of .NET Core, these applications are all Windows-only. The advantage of .NET Core is that Windows desktop developers can now keep up to date with the latest improvements, whereas .NET Framework is now considered legacy.
There are also new refactorings for C#. These are Extract Local Function (using the Local Function feature supported by C# 7.0 and higher), Make Static, and Simplify string interpolation. String interpolations are a way to format results into strings.
Cross-platform development using Xamarin has some improvements too. Hot Restart for iOS is now in preview, letting you make changes to code while debugging on a device and click Restart to get the changes applied. Currently this only works with Xamarin Forms applications on iOS, and there are other limitations. Android developers get a similar feature called Android Apply Changes, which updates a running application with changes to resource files.
A full list of the changes and fixes can be found here.
Why is Microsoft putting effort into C++ development tools for Linux? There is a case study from EA here. "At EA our game developers are used to a Windows environment for development so we thought that forcing them to develop in a Linux environment directly would be a difficult ask, so we decided to use clang and cross-compile from Windows and target Linux," says senior software engineer Ben May.
Strategically then, Microsoft is keeping developers on Windows despite the increasing demand for deploying to Linux servers. It is the same with ASP.NET Core: develop in Windows, deploy to Linux. This updated Visual Studio is another small step indicating the growing importance of Linux in Microsoft's world. ®