C# 8.0 in-depth: Setup C# 8.0 and .NET Core 3.0

Currently, Microsoft has the second preview of C# 8.0 and .NET Core 3.0, with a lot of new features and new APIs. This part of C# 8.0 series demonstrates how to setup the environment.

One way to setup the environment is to install Visual Studio 2019 preview (https://visualstudio.microsoft.com/vs/preview/). However, if you use Linux or macOS, or you do not have tons of space on your hard drive, you can go with Visual Studio Code. After all it is just a text editor.

Setup .NET Core preview SDK

First, install the latest SDK of .NET Core 3.0 for your operating system from the official website: https://dotnet.microsoft.com/download/dotnet-core/3.0. Currently v3.0.0-preview2/SDK 3.0.100-preview-010184 is the latest. Then run the following command to verify the installation:

dotnet --version

By default, the dotnet CLI uses the latest SDK installed for dotnet build and dotnet new, etc.. If you want to go back to the previous stable SDK, use the global.json to specify the stable SDK version for your directory. First, run dotnet –list-sdks to view all the installed SDKs, then run dotnet new globaljson –skd-version {version} to create the global.json file. Then run dotnet –version to verify the changed SDK version:

C:\Users\dixin>dotnet --list-sdks
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.503 [C:\Program Files\dotnet\sdk]
2.2.100 [C:\Program Files\dotnet\sdk]
3.0.100-preview-010184 [C:\Program Files\dotnet\sdk]


d:\>cd User\GitHub\CodeSnippets\Linq.Range\Test

d:\User\GitHub\CodeSnippets\Linq.Range\Test>dotnet new globaljson --sdk-version 2.2.100
The template "global.json file" was created successfully.

d:\User\GitHub\CodeSnippets\Linq.Range\Test>type global.json
  "sdk": {
    "version": "2.2.100"
d:\User\GitHub\CodeSnippets\Linq.Range\Test>dotnet --version

Setup Visual Studio Code with preview C# extension

Now Visual Studio Code should work with dotnet CLI, since it is just a text editor. The latest preview C# extension can be installed for a little better experience with C# 8.0. Go to its GitHub repo: https://github.com/OmniSharp/omnisharp-vscode/releases. Currently the latest preview is v1.18.0-beta7. Download the .vsix installer, then load it to Visual Studio Code:


After that, the extensions version shows 1.18.0-beta7:


Setup project

Now create a new console app project with dotnet CLI: dotnet new console. Then open the created .csproj file, enable C# 8.0 by adding <LangVersion>8.0</LangVersion>, and enable C# 8.0 nullable reference type check by adding <NullableContextOptions>enable</NullableContextOptions>. The .csproj file becomes:

<Project Sdk="Microsoft.NET.Sdk">



In preview 1, <NullableReferenceTypes>true</NullableReferenceTypes> was used. Now it is changed to <NullableContextOptions>. Then you can start coding C# 8.0 and .NET Core 3.0, and press F5 to start debugging with Visual Studio Code.

If you create a library project, the default target framework is TargetFramework is netstandard2.0. It must be changed to netcoreapp3.0. The entire .csproj becomes:

<Project Sdk="Microsoft.NET.Sdk">



The difference is no  <OutputType>Exe</OutputType>.


  • When using the IConfigurationBuilder in a .NET Core 2.1 application with a Generic Host I configure 4 sources; but after the scope of ConfigureAppConfiguration there are 6 sources.

    At some point 2 additional source I have already loaded are added a second time in an order that is causing appsettings.Environment.json values to be hidden. I have also tried removing the hostsettings.json configuration and verified that is not affecting this. This is for an Azure Webjob using WebjobsSDK 3.0 and .Net Core 2.1

  • The details are given of the setup c 8.0 and the net core 3.0 is very well described and by the post we can get to know about them and how it is going to be implemented and that is the main thing in that and for the developers, it will also be helpful.

  • To create a suitable project for trying out all currently available C# 8.0 features, you can follow these steps:

    1. Create a new .NET Core project of any type.

    2. In the Application pane of the Project Properties window, make sure that the Target Framework is set to .NET Core 3.0.

    3. From the Build pane of the Project Properties window, open the Advanced Build Settings dialog and select C# 8.0 (beta) as the Language version.

  • Shot:

    C:\>dotnet --version


    error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0.

    LOL fuck off.

  • I think .Net the best programming language

  • You’re the best teacher ever!

  • I like reading through a post that can make people think. Also, thank you for allowing for me to comment!

  • Cyber security is the practice of preventing malicious attacks on computers, servers, mobile devices, electronic systems, networks, and data. Additionally, it is referred to as information technology security or electronic data security.

    <a href="https://breezendtech.com/" rel="nofollow">Security Solutions, Security Solutions, Threat Management, Incident Response, cybersecurity solutions, cyber security company, Cyber Security Services</a>

  • https://ma-study.blogspot.com/

  • مرجع خدمات عروسی با بهترین تالارهای غرب تهران و احمدآباد مستوفی. تالار عروسی را انتخاب کنید قیمت عروسی
    باغ تالارهای تهران محلی مناسب برای جشنهای عروسی است که بسیاری از مراسمات مانند عقد، نامزدی، تولد، سمینار، میتینگ و همایش و گردهمایی ها در آن برگزار می‌شود و همه تمایل دارند یک باغ مناسب برای مراسم خود داشته باشند.

  • آرایشگاه داماد تهران حمید بخشی تهران گریم زعفرانیه تهران پاکسازی پوست
    داماد داماد داماد عروسی

  • First of all, thank you for your post. Keo nha cai Your posts are neatly organized with the information I want, so there are plenty of resources to reference. I bookmark this site and will find your posts frequently in the future. Thanks again ^^

Add a Comment

As it will appear on the website

Not displayed

Your website