How can I enable all features of C# 7 in Visual Studio 2017 project?

后端 未结 3 2178
醉梦人生
醉梦人生 2020-12-15 02:35

After Visual Studio 2017 was released I wanted to try to create simple console project with new C# 7 features. I expected that I simply download new Visual Studio 2017, then

3条回答
  •  难免孤独
    2020-12-15 02:51

    Any project that targets .NET 4.7 can use C# 7 tuples without adding a Nuget package. You'll have to install it manually:

    1. Upgrade to Windows 10 Creator's Update (10.0.15063), or install .NET Framework 4.7 on other versions of Windows: https://www.microsoft.com/en-us/download/details.aspx?id=55170
    2. From the Start menu, run Visual Studio Installer and click Modify. Go to "Individual components" and check the following two components:
      • .NET Framework 4.7 SDK
      • .NET Framework 4.7 targeting pack

    It doesn't work out-of-the-box on Windows 10 Creator's Update because Microsoft omitted the .NET 4.7 components from the ".NET desktop environment" workload. I filed a bug, but they closed it as Not a Bug:

    • https://developercommunity.visualstudio.com/content/problem/41930/vs-2017-does-not-install-net-47-sdk-and-targeting.html

提交回复
热议问题