Why can't the command-line csc compile C# 7 after installing VS 2017?

前端 未结 2 1318
独厮守ぢ
独厮守ぢ 2021-01-12 18:52

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

相关标签:
2条回答
  • 2021-01-12 18:55

    You have to launch "Developer Command Prompt for VS 2017 RC". Then you can see that csc.exe will have a version number of 2.0.

    It has been well known that for every new VS release you should use its dedicated prompt with the appropriate environment variables loaded.

    0 讨论(0)
  • 2021-01-12 19:07

    You can run "where csc.exe" from the visual studio 2017 command prompt and export the version of csc you need by adding it to the Path system variable. I was in a similar case where i needed to compile via command line and i ended up setting

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\
    

    in system Path.

    0 讨论(0)
提交回复
热议问题