Get Started with .NET Core and Visual Studio 2017

Introduction

Today, I will aim to introduce you to the fantastic world of .NET Core. Let’s get started!

.NET Core

.NET Core is a cross-platform development platform on GitHub. .NET Core has the following characteristics:

  • Command-line tools: All product scenarios can be executed at the command line.
  • Compatibility: .NET Core is compatible with Mono, Xamarin, and the .NET Framework with the help of the .NET Standard Library.
  • Cross-platform support: .NET Core can be run on Windows, macOS, and Linux.
  • Flexible deployment: .NET Core can be included in your applications or installed side-by-side.
  • Open source: .NET Core platform is open source and makes use of MIT and Apache 2 licenses.

.NET Core is comprised of the following:

  • The .NET Runtime that provides the common type system and assembly loading
  • Framework Libraries that provide App Composition Types and Primitive Data Types
  • SDK Tools that enable the base developer experience
  • A ‘dotnet’ app host that is used to launch .NET Core apps

Application Models

.NET Core includes a single Application Model, Console Apps. Console Apps is useful for local services, tools, and text-based games. Additional Application Models have, however, been built on top of .NET Core to extend its functionality. These Application Models include:

  • ASP.NET Core
  • Windows 10 Universal Windows Platform (UWP)
  • Xamarin.Forms

ASP.NET Core

ASP.NET Core is a cross-platform framework for building cloud-based, Internet-connected applications such as Mobile Back-ends, Web apps, and IoT apps. ASP.NET Core apps consist of modular components with minimal overhead so that you retain flexibility while constructing your apps. You can develop as well as run your ASP.NET Core apps cross-platform on Windows, Mac, and Linux.

ASP.NET Core is no longer based on System.Web.dll. Instead, it is based on a set of granular NuGet packages. This allows you to optimize your app to include just the NuGet packages you need.

Foundational improvements with ASP.NET Core include the following:

  • Cloud-ready, environment-based configuration system
  • Ability to host on IIS or self-host in your own process
  • Build and run cross-platform ASP.NET apps on Windows, Mac, and Linux
  • A unified story for building Web UIs and Web APIs
  • Integration of modern client-side frameworks and development workflows
  • Ships entirely as NuGet packages
  • Built-in dependency injection

Windows 10 Universal Windows Platform (UWP)

A UWP (Universal Windows Platform) app can run on any Windows-based device, from your phone to your tablet or PC.

UWP App Features

  • Effective pixels and scaling: UWP apps can automatically adjust the size of fonts, controls, and any other UI elements so that they are legible on all devices.
  • Universal input and smart interactions: You can design your apps for specific input modes and devices, but you aren’t required to. This is because UWP apps rely on smart interactions by default. This means that you can design around a click interaction without having to know or define whether the click comes from an actual mouse click or the tap of a finger.

Universal Controls and Styles

UWP provides useful building blocks that make it easier to design apps for multiple device families.

  • Universal controls: UWP provides a set of universal controls that are guaranteed to work well on all Windows-powered devices. This set of universal controls includes everything from common form controls such as radio buttons and text boxes to gridviews and listviews.
  • Universal styles: UWP apps automatically get a default set of styles that includes the following features:
    • Automatic support for high-contrast modes
    • Automatic support for other languages
    • Default animations for interactions
    • A set of styles that automatically gives your app a light or dark theme
    • Built-in support for RTL reading order
    • A Segoe-based type ramp that ensures that app text looks crisp on all devices

Xamarin.Forms

Use the Xamarin.Forms API to quickly build native apps for iOS, Android, and Windows completely in C#.

.NET Core Packages

.NET Core Packages contains the .NET Core runtime and libraries such as System.Net.Http. .NET Core is split into a set of packages that provide primitives, higher-level data types, app composition types, and common utilities.

Advantages to defining packages in a fine-grained manner:

  • Apps are smaller because unreferenced packages do not become part of the app distribution.
  • Fine-grained packages provide differing OS and CPU support.
  • Fine-grained packages have dependencies specific to only one library.
  • Fine-grained packages ship on their own schedule with relatively limited testing of other packages.

.NET Core Metapackages

.NET Core Metapackages describe layers and app-models by referencing the appropriate set of versioned library packages. Earlier .NET Core tools (both project.json- and csproj-based tools) versions specified both a framework and a metapackage by default. Currently, the metapackage is implicitly referenced by the target framework, so that each metapackage is tied to a target framework. For example, the netstandard1.6 framework references the NetStandard.Library version 1.6.0 metapackage.

Advantages to Using Metapackages

  • Provides a convenient user experience to reference a large set of fine-grained packages.
  • Defines a set of packages that are tested and work well together.

NET Standard Library Metapackage

  • NETStandard.Library: Describes the libraries that are part of the .NET Standard Library.

Key .NET Core Metapackages

  • Microsoft.NETCore.App: Describes the libraries that are part of the .NET Core distribution.
  • Microsoft.NETCore.Portable.Compatibility: A set of compatibility façades that enable mscorlib-based Portable Class Libraries (PCLs) to run on .NET Core.

Downloading .NET Core

Downloading the Runtime for Visual Studio 2015

To download .NET Core for Visual Studio 2015, navigate to this link.

There are a few options:

NET Core Downloads

Figure 1: Downloading the Runtime

Once Install is clicked, a screen similar to Figure 2 will be displayed.

Downloading the Runtime

Figure 2: Installing the .NET Core Runtime

Finally, with a successful installation,you will get a completion notice similar to Figure 3:

Successful NET Core Installation

Figure 3:Successful Installation of the .NET Core Runtime

Installing the SDK

With Visual Studio 2017, you do not need to install the Runtimes because it is already present in Visual Studio 2017.

Installing the SDK for Visual Studio 2015

To download the SDK for Visual Studio 2015, navigate to the link given.

There are a few options:

Installing the SDK for Visual Studio 2017

To download the SDK for Visual Studio 2017, navigate to this link.

Click the Download .NET Core SDK button, and the download will start.

Conclusion

This article’s aim was to introduce you to .NET Core in Visual Studio 2015 and Visual Studio 2017. Now that you know where to download it and how to get started, go out and conquer the world.

Hannes DuPreez
Hannes DuPreez
Ockert J. du Preez is a passionate coder and always willing to learn. He has written hundreds of developer articles over the years detailing his programming quests and adventures. He has written the following books: Visual Studio 2019 In-Depth (BpB Publications) JavaScript for Gurus (BpB Publications) He was the Technical Editor for Professional C++, 5th Edition (Wiley) He was a Microsoft Most Valuable Professional for .NET (2008–2017).

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read