Book Image

C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition

Book Image

C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition

Overview of this book

If you want to build powerful cross-platform applications with C# 7 and .NET Core, then this book is for you. First, we’ll run you through the basics of C#, as well as object-oriented programming, before taking a quick tour through the latest features of C# 7 such as tuples, pattern matching, out variables, and so on. After quickly taking you through C# and how .NET works, we’ll dive into the .NET Standard 1.6 class libraries, covering topics such as performance, monitoring, debugging, serialization and encryption. The final section will demonstrate the major types of application that you can build and deploy cross-device and cross-platform. In this section, we’ll cover Universal Windows Platform (UWP) apps, web applications, mobile apps, and web services. Lastly, we’ll look at how you can package and deploy your applications so that they can be hosted on all of today’s most popular platforms, including Linux and Docker. By the end of the book, you’ll be armed with all the knowledge you need to build modern, cross-platform applications using C# and .NET Core.
Table of Contents (24 chapters)
C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Managing source code with GitHub


Git is a commonly used source code management system. GitHub is a company, website, and desktop application that makes it easier to manage Git.

I used GitHub to store solutions to all the practical exercises at the end of each chapter at the following URL:

https://github.com/markjprice/cs7dotnetcore.

Using Git with Visual Studio 2017

Visual Studio 2017 has built-in support for using Git with GitHub as well as Microsoft's own source code management system named Visual Studio Team Services.

Using the Team Explorer window

In Visual Studio 2017, navigate to View | Team Explorer to see the Team Explorer window:

Although it is a good idea to sign up with an online source code management system provider, you can clone a GitHub repository without signing up for an account.

Cloning a GitHub repository

In the Team Explorer window, expand Local Git Repositories, click on the Clone menu, and then enter the following URL of a Git repository to clone it: https://github.com/markjprice/cs7dotnetcore.git.

Enter a path for the cloned Git repository:

C:\Code\Repos\cs7dotnetcore

Click on the Clone button.

Wait for the Git repository to clone locally.

You will now have a local copy of the complete solutions to all the hands-on practice exercises for this book.

Managing a GitHub repository

Double-click on the cs7dotnetcore repo to open a detail view.

You can click on the options in the Project section to view Pull Requests and Issues and other aspects of a repository.

You can double-click on an entry in the Solutions section to open it in the Solution Explorer.

Using Git with Visual Studio Code

Visual Studio Code has support for Git, but it will use your OS's Git installation, so you must install Git 2.0 or later first before you get these features. You can install Git from here: https://git-scm.com/download.

Note

If you like to use a graphical user interface, you can download GitHub Desktop here: https://desktop.github.com.

Configuring Git at the command line

Launch Terminal, and enter the following command to check your configuration:

git config --list

The output should include your username and e-mail address, because these will be used with every commit that you make:

...other congfiguration...
user.name=Mark J. Price
[email protected]

If your user name and e-mail has not been set, to set your user name and email, enter the following commands, using your own name and e-mail, not mine:

git config --global user.name "Mark J. Price"
git config --global user.email [email protected]

You can check an individual configuration setting like this:

git config user.name

Managing Git with Visual Studio Code

Launch Visual Studio Code.

Navigate to View | Integrated Terminal or press Ctrl+ ` and enter the following commands:

cd Code
mkdir Repos
cd Repos
git clone https://github.com/markjprice/cs7dotnetcore.git

It will take a minute to clone all the solutions for all the chapters to your local drive, as shown in the following screenshot:

It is best to open one project folder at a time because the cs7dotnetcore repository does not include any dependencies, so you will need to restore them using the dotnet restore command, or wait for Visual Studio Code to prompt you after opening a folder.

For more information about source code version control with Visual Studio Code, visit: https://code.visualstudio.com/Docs/editor/versioncontrol.