VS Code CSC : error CS1617: Invalid option '7.3' for /langversion
Clean and Rebuild didn't work for me until I closed Visual Studio and deleted the .vs folder then re-opened, cleaned and rebuilt.
Just had this and a Clean, Rebuild fixed the issue for me.
On VS 2019, I went to project files, changed the target framework to 4.7.2 from 4.6.2, the project build successfully. Then revert back to 4.6.2 and it still builds successfully
Come October 2020, and I'm on VS 2019 .. and this is my error that caused me to google my way to this post:
CS1617 Invalid option '7.3' for /langversion; must be ISO-1, ISO-2, Default, Latest or a valid version in range 1 to 7.1
FWIW - I'm just working on an old school .NET Framework / ASP.NET / Web API2 project, fwiw, not trying to do anything cool with Standards or Core...
I'm scratching my head because:
- It works on my workstation at work
- It works on my Azure CI pipeline
- So.. why not on my Win 10 pro workstation at home?
Solution
- I launched the Visual Studio Installer > 2019 > More > Modify screen
- Switched to
Individual Components
tab, scrolled down toCode Tools
- and found this little checkbox needed checking
NuGet targets and build tasks
This was the only thing I could readily discern as different between my 2 workstations at work and home. I presume checking the box made the difference, and not merely the fact that I was forced to close and restart Visual Studio after I had restored the nugets.. but you never know.