Transitioning to .NET Core on Red Hat Enterprise Linux

Book description

Everything in the .NET world has changed, and decidedly for the better. Not only is .NET Core now an open source framework, but thanks to Microsoft’s recent partnership with Red Hat, you can develop and run .NET web applications on Linux. In this report, author Don Schenck shows you how to create simple applications with ASP.NET, MVC, and Entity Framework, and then helps you tackle a full-featured application running in a Linux container.

If you have experience with .NET and the C# language—or a willingness to learn them—you’re ready to go. Experienced developers will be interested in the few key differences when developing for Linux, while beginning developers can use this book to learn some more advanced programming techniques.

  • Build "hello world" console and web apps, and then examine the code output
  • Create a more complex model-view-controller web app with the ASP.NET MVC framework
  • Develop a RESTful service with the same techniques and technologies used for your MVC website
  • Get acquainted with several new features in Entity Framework Core 1.0
  • Use Visual Studio Code, the free code editor that supports several languages and operating systems
  • Learn how to keep and run your code in Linux and edit it in Windows
  • Perform "offroad debugging" on .NET applications from Visual Studio

Don Schenck is the Director of Developer Experience at Red Hat, focusing on Microsoft .NET on Linux. His mission is to bring .NET developers into the Linux and open source communities. Prior to Red Hat, Don was a front-end and mobile developer.

Table of contents

  1. What to Expect from This Book
    1. Some Assumptions
    2. Your Environment
    3. Formatting
    4. .NET Core Is the Future
    5. What’s Missing
    6. What’s New
  2. 1. Setting Up Your Environment
    1. Your Red Hat Account
    2. Installing the CDK
    3. Disable Hyper-V
    4. Start Your VM
    5. Getting the Source Code
  3. 2. Getting Started: From Zero to “Hello World” in One Chapter
    1. From Zero to “Hello World” in One Chapter
    2. Overview of .NET
    3. Installing .NET
      1. .NET CLR
      2. .NET CoreFX
      3. .NET CLI
      4. ASP.NET Core
      5. Tooling
      6. Installation Instructions
      7. Other Linux Distros
      8. Keeping Current
    4. Your First .NET Application on Linux
  4. 3. Diving into the “Hello World” Application
    1. The dotnet new Command
    2. The dotnet restore Command
      1. What Gets Restored?
      2. Where Do the Dependencies Go?
    3. Library Versioning in project.json
    4. What Gets Built?
  5. 4. “Hello World” for the Web
    1. The Kestrel Web Server
    2. The project.json File
      1. “Microsoft.AspNetCore.Server.IISIntegration”: “1.0.0”
      2. “Microsoft.AspNetCore.HttpOverrides”:" 1.0.0”
      3. “Microsoft.AspNetCore.Server.Kestrel”: “1.0.0”
      4. “frameworks”: “netcoreapp1.0”
    3. Program.cs: Where the Magic Happens
  6. 5. ASP.NET and MVC
    1. Creating a Basic MVC Web Application
    2. MVC: An Inside Look
    3. Environments
    4. Error-Handling Example
    5. Startup Conventions and Environments
  7. 6. Creating a RESTful Microservice
    1. RESTful Microservices
  8. 7. Using Entity Framework Core
    1. Adding EF Is Easy
    2. The EF Command
    3. Other New Parts
  9. 8. Creating a Standalone Application
    1. Creating the Application
    2. The Debug Build
    3. The Release Build
  10. 9. Visual Studio Code
    1. Installing Visual Studio Code
    2. Launching VS Code
  11. 10. Editing from Windows
    1. The Key: Sharing
      1. Step 1: Create a Share on Your Windows PC
      2. Step 2: Share the Folder
      3. Step 3: Share the Folder with Your Linux VM
      4. Step 4: Restart the VM
      5. Step 5: Move into the VM and View the Directory
  12. 11. “Off-Road” Debugging
    1. Installation and Configuration
      1. Step 1: Enable Visual Studio on Windows
      2. Step 2: Install CLRDBG on the Linux VM
      3. Step 3: Set Up SSH
      4. Step 4: Share a Folder/Directory
      5. Step 5: Create Launch Options File
      6. Step 6: Start Debugging
  13. 12. .NET Core, Linux, and Containers
    1. Building the Image
    2. Configuring the Image
    3. Running the Image in a Container
  14. 13. Final Notes

Product information

  • Title: Transitioning to .NET Core on Red Hat Enterprise Linux
  • Author(s): Don Schenck
  • Release date: September 2016
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491970553