I just downloaded Visual Studio 2017 RC, which was released a few days ago and comes with C # 7 support. I can use C # 7 functions from the IDE:

However, this behavior does not seem to be true for the command line. I am working on a project that requires the csc handle C # 7 and above. However, when I try to go to the same directory as the project and compile the file, I get
> csc Program.cs /target:exe Microsoft (R) Visual C# Compiler version 1.3.1.60616 Copyright (C) Microsoft Corporation. All rights reserved. Program.cs(12,23): error CS1026: ) expected Program.cs(12,25): error CS1001: Identifier expected Program.cs(12,25): error CS1002: ; expected Program.cs(12,26): error CS1002: ; expected Program.cs(12,26): error CS1513: } expected Program.cs(13,32): error CS1003: Syntax error, '=>' expected Program.cs(13,32): error CS1525: Invalid expression term '='
So it looks like the csc version found in my PATH does not support C # 7. I did a little research and found a similar question for C # 6, which suggested checking that you call csc from %PROGRAMFILES(x86)%\MSBuild\14.0\Bin instead of the old one from C:\Windows\Microsoft.NET\Framework\4.0.30319 , since the latter only supports C # 5. So I did just that:
> where csc C:\Program Files (x86)\MSBuild\14.0\Bin\csc.exe C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe
As you can see, the directory is selected from the MSBuild\14.0\Bin directory, and not the old one in v4.0.30319 . I also ran csc /version , which tells me that the csc version is 1.3.1.60616, which really only supports C # 6.
Does anyone know how to enable C # 7 features for the csc version on the command line? Thanks!
source share