Skip to content

Source Generator needs new .NET lang version to be modified in project? #4229

@hawkerm

Description

@hawkerm

Describe the bug

More of a doc issue maybe? Seems like the Source Generators require the .NET Standard project to be modified to a newer language version than the default template:

__KnownINotifyPropertyChangedOrChangingArgs.cs(43,122,43,125): error CS8370: Feature 'target-typed object creation' is not available in C# 7.3. Please use language version 9.0 or greater.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Open VS and create a new .NET Standard 2.0 Class Library
  2. Add MVVM Toolkit package (7.1-rc1)
  3. Start using source generators like ObservableProperty
  4. Get error about upgrading version

Expected behavior

Think this'll need to be clearly documented unless they can detect or generate for the language version available?

Screenshots

Environment

NuGet Package(s): 7.1.0-rc1

Windows 10 Build Number:

  • Fall Creators Update (16299)
  • April 2018 Update (17134)
  • October 2018 Update (17763)
  • May 2019 Update (18362)
  • May 2020 Update (19041)
  • Insider Build ({build_number})

App min and target version:

  • Fall Creators Update (16299)
  • April 2018 Update (17134)
  • October 2018 Update (17763)
  • May 2019 Update (18362)
  • May 2020 Update (19041)
  • Insider Build ({build_number})

Device form factor:

  • Desktop
  • Xbox
  • Surface Hub
  • IoT

Visual Studio version:

  • 2017 (15.{minor_version})
  • 2019 (16.{minor_version})
  • 2022 (17.{minor_version})

Additional context

FYI @Sergio0694

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions