Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Roslyn instead csc.exe from command line?

Tags:

After installing VS 2015, running csc.exe from command line causes this message to be displayed to console:

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

The link redirects to Roslyn's repository at GitHub.
So, is the a way to run "compilers that support newer versions" (Roslyn) from command line?

like image 820
Dennis Avatar asked Aug 07 '15 10:08

Dennis


People also ask

How can I run AC sharp program in CMD?

To run C# Code in cmdset path of cmd by using (set path="") command. Now go to the folder (by using cmd) in which you save your c# file which you create in step 2. Now enter csc "your file name."cs in cmd. Now if you set correct path and your coding is correct then a .exe file is created run that file on cmd.

What is command line compiler in C#?

You can invoke the C# compiler by typing the name of its executable file (csc.exe) at a command prompt. For . NET Framework projects, you can also run csc.exe from the command line. Every compiler option is available in two forms: -option and /option.


1 Answers

It sounds like your path is inappropriate, basically. If you open the "Developer Command Prompt for VS2015" you should have $ProgramFiles(x86)$\MSBuild\14.0\bin early in your path - and the csc.exe in there is Roslyn.

I suspect you're running the version in c:\Windows\Microsoft.NET\Framework\4.0.30319 or similar - which is the legacy one, basically.

like image 142
Jon Skeet Avatar answered Sep 26 '22 16:09

Jon Skeet