BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Visual Studio 2019 for Mac Adds ASP.NET Core Blazor Server Applications

Visual Studio 2019 for Mac Adds ASP.NET Core Blazor Server Applications

This item in japanese

Bookmarks

In January, Microsoft released Visual Studio 2019 for Mac 8.4.3 with a handful of features and improvements that were a direct request from developers on their developer community forum. Visual Studio for Mac can target the latest platform capabilities, for Android, iOS, as well as .NET Core applications that can be hosted on Windows, macOS or Linux.

This new release includes support for the latest stable version of .NET Core 3.1, the ability to create .NET Core Blazor Server applications, scaffolding, improvements to the IDE, refinements to the editing experience and distribution support for creating NuGet packages from the .NET Core library.

Supporting .NET Core 3.1 brings with it a small series of improvements primarily focused on Blazor, the two major new additions in .NET Core 3.0; this version is also a long-term supported (LTS) release, guaranteeing support for three years.

The .NET Core Blazor Server is based on the Blazor framework for building interactive applications.

Blazor Server works is by packing the C# components into a DLL and sending it to run in the browser. The client-side JavaScript also sets up a SignalR connection back to the server and all of the Blazor runtime rendering is done server-side. This creates a real-time bi-directional communication between the browser and the server. Alternatively, Blazor can run exclusively on the client-side with WebAssembly: the Blazor runtime renders each component when requested, building a fake render tree inside the browser in memory space.

This allows developers to have shared DLLs that run on a Windows desktop with a model in it, to be used as a data model on a Visual Studio for Mac Blazor project. This is one DLL and there will be no more need to keep all views models and data models in sync between projects; it’s the same model.

The new Visual Studio feature enables developers to create, run and debug Blazor projects. The project template can be found when creating a New Project; under .NET Core resides a Blazor Server App project template.


 
(Source: Microsoft Visual Studio for Mac dev blog)

In addition to .NET Core Blazor Server, this release enables scaffolding which generates boilerplate code for common scenarios. This was a top requested feature from the community. Scaffolding is used to generate code for basic CRUD operations against database models effectively; scaffold templates consist of page templates, entity page templates, field page templates, and filter templates.

A new entry was added in the Add flyout called New Scaffolding, the node on which the right-click menu is opened will be the location where the generated files will be placed. A scaffolding wizard will pop up to assist in the generating code. After that, Visual Studio will add the required NuGet packages and create additional pages, based on the scaffolder.

Positive feedback already appeared on Twitter. Cody Beye, product manager at Microsoft, asked the community about feedback on the release. User SpeedDemonSA commented:

Very happy with the new scaffolding feature. It was right on the top of my #VS4Mac wish list and now that it is here, it seems to work really well too. Thanks and well done

This release also features an IDE change that supports assistive technologies to ensure Visual Studio for Mac can be used by all. The editor has also been improved to support full colorization, completion, and IntelliSense for .razor files.

It is important to note that Blazor WebAssembly is currently in preview and is targeted to release in May 2020

To match more of the features and feel of VS for Windows, Visual Studio 2019 for Mac 8.4.3 added the option to create a NuGet package from a .NET Core library by right-clicking a project then selecting Pack. Visual Studio will then create a NuGet package (.nupkg) file in the output folder.


 
(Source: Microsoft Visual Studio for Mac dev blog)

Developers are being heard by filling bug reports and sharing feature suggestions on the Developer Community, which means the Visual Studio 2019 for Mac roadmap is directly driven by community feedback.

The next version of Visual Studio 2019 for Mac 8.5 is in preview and it brings new enhancements in Xamarin, new templates for ASP.NET Core projects and refinements to support accessibility. In this version developers will be able to:

  • Quickly see changes made to resource files without requiring the Android application to be restarted;
  • Multi-target reload changes to XAML instantly on multiple targets such as an iOS Simulator or Android emulator at the same time;
  • XAML document outline enables developers to see the hierarchy of Xamarin.Forms UI in the "Document Outline" pane;
  • Ability to set the default iOS designer in Visual Studio for Mac, enabling developers to use the tools that they judge the most productive for authoring iOS UIs.

 

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT