Book Image

ASP.NET Core MVC 2.0 Cookbook

By : Jason De Oliveira, Engin Polat, Stephane Belkheraz
Book Image

ASP.NET Core MVC 2.0 Cookbook

By: Jason De Oliveira, Engin Polat, Stephane Belkheraz

Overview of this book

The ASP.NET Core 2.0 Framework has been designed to meet all the needs of today’s web developers. It provides better control, support for test-driven development, and cleaner code. Moreover, it’s lightweight and allows you to run apps on Windows, OSX and Linux, making it the most popular web framework with modern day developers. This book takes a unique approach to web development, using real-world examples to guide you through problems with ASP.NET Core 2.0 web applications. It covers Visual Studio 2017- and ASP.NET Core 2.0-specifc changes and provides general MVC development recipes. It explores setting up .NET Core, Visual Studio 2017, Node.js modules, and NuGet. Next, it shows you how to work with Inversion of Control data pattern and caching. We explore everyday ASP.NET Core MVC 2.0 patterns and go beyond it into troubleshooting. Finally, we lead you through migrating, hosting, and deploying your code. By the end of the book, you’ll not only have explored every aspect of ASP.NET Core MVC 2.0, you’ll also have a reference you can keep coming back to whenever you need to get the job done.
Table of Contents (26 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Installing or updating .NET Core


In this recipe, we will learn how to set up .NET Core. This recipe is pivotal if you are installing it for the first time.

Installing .NET Core is a relatively easy task. Microsoft did a great job to make it easy to install .NET Core to any computer. All we need is a clean computer and an internet connection.

How to do it...

The first step is to open a web browser and navigate to the http://dot.net/core site. It'll detect a host operating system, and will show downloading and installation steps.

  • Installation for Windows: On the Windows platform, we can easily download .NET Core SDK installer by clicking the Download .NET Core SDK button and beginning setup. Once setup finishes, you're ready to develop/run .NET Core applications on the machine.
  • Installation for Linux: On the Linux platform, there are different commands to install .NET Core on Ubuntu, RedHat, Debian, Fedora, CentOS, and Suse distribution. We should select the correct distribution on the page, and execute some Terminal commands by following preceding instructions.
  • Installation for macOS: On the macOS platform, it's as easy as downloading the .NET Core SDK package.
  • Installation for Docker: There is another platform available to deploy and run .NET Core applications: Docker. Docker is simply a virtualization platform. You may run Docker on the machine and deploy your .NET Core applications into Docker. Once you successfully deploy an application to Docker, it's easy to run more than one instance of it.

Docker usually helps developers to scale their applications with minimum management cost.

How it works...

After installing .NET Core 2.0 SDK, you can open the Terminal/Command Prompt window and run the following command:

dotnet --info

This command displays the installed and most recent .NET Core SDK version (2.0.2 at the time this book was written), Runtime Environment info (OS platform, architecture, version, and more), and .NET Core SDK installation path:

We can see Base Path includes the .NET Core SDK version. If we remove that version from the path and open that path in Finder/Explorer, we can see all the installed .NET Core SDK versions:

It's as easy as deleting a folder to remove any .NET Core SDK version on a machine.