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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 10:49:25

问题


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:


回答1:


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)
  2. In Project → Properties → Build Select Advanced… (Advanced Build Settings)
    Select the desired C# version:



回答2:


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



来源:https://stackoverflow.com/questions/56639685/use-preview-features-preview-language-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!