Use preview features & preview language in Visual Studio

Viewed 36368

How can I turn on C# preview features in Visual Studio?

The feature 'nullable reference types' is currently in Preview and "unsupported". To use Preview features, use the 'preview' language version.

The project Properties does not offer "unsupported preview of next C# version (preview)" as an option: No preview C sharp preview available

2 Answers

Synopsis

In order to turn on the preview features, you need all these:

  • Visual Studio preview (recommended)
  • .NET preview (required)
  • Change the Project Application settings
  • Change the Project Build settings

Step by Step

  1. Download Visual Studio 2019 Preview
  2. Download .NET SDK Preview for Visual Studio
  3. Check your installation from a cmd-line:
   > dotnet --list-sdks
   2.1.202 [C:\Program Files\dotnet\sdk]
   …
   2.2.101 [C:\Program Files\dotnet\sdk]
   3.0.100-preview6-012264 [C:\Program Files\dotnet\sdk]
  1. Right-click on your Project → Properties → Application
    Pick the Target Framework (note the link to Install other frameworks… as well) .NET Core 3.0
  2. In Project → Properties → Build Select Advanced… (Advanced Build Settings)
    Select the desired C# version: Unsupported preview of next C sharp version

I my case I needed to check this checkbox (and restart Visual Studio!)

enter image description here

Related