简体   繁体   中英

C# version error when building with msbuild, ok with Visual Studio

I can build my project just fine using Visual Studio 2017; however when I use msbuild 15, I get this eror:

error CS8306: Tuple element name 'value' is inferred. Please use language version 7.1 or greater to access an element by its inferred name.

The language version is set to 7.3 in my project file; why would I get this error when running msbuild?

I figured it out - thanks to Olivier Jacot-Descombes who suggested I look in the project properties!

What I needed to do was set my C# version for all platforms (eg any CPU, x68, x64) to 7.3 in addition to setting it for all configurations (debug/release) as he'd suggested.

MSbuild 15 does not support .NET Framework 4.7.2 .

Per the GitHub issue, this was merged in May: github.com/Microsoft/msbuild/issues/3285

Version 15.7.180 should work: https://github.com/Microsoft/msbuild/releases/tag/v15.7.180.61344

Edit: Version 15.8.166.59604 shipped with Visual Studio 15.8, which was released in April. Though, support for .NET Framework 4.7.2, was implemented in May.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM