Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use preview features & preview language in Visual Studio [duplicate]

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

like image 517
SwiftArchitect Avatar asked Jun 17 '19 22:06

SwiftArchitect


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
like image 200
SwiftArchitect Avatar answered Oct 03 '22 17:10

SwiftArchitect


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

enter image description here

like image 42
Julian Avatar answered Oct 03 '22 16:10

Julian