Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Roslyn end-user preview be installed without Visual Studio?

Tags:

.net

roslyn

The Roslyn end-user preview is a VSIX (Visual Studio extension), but it replaces the compilers in the system .NET Framework installation, such that involving csc.exe from the command-line will begin using Roslyn.

Is it possible to install the Roslyn csc.exe on a computer without Visual Studio installed? How?

(Yes, Roslyn works with Visual Studio 2013 Express, so licensing is not an issue. But disk space IS. Even the Express edition has a very large footprint compared to say SharpDevelop.)

like image 927
Ben Voigt Avatar asked Apr 20 '14 00:04

Ben Voigt


People also ask

How do I install Roslyn?

To install Roslyn compilers without installing Visual Studio, you need to download and install Microsoft Build Tools. Roslyn can also be downloaded from Github, then you can compile and get binary files csc.exe and vbc.exe, which can be accessed from the command line.

What is Roslyn Visual Studio?

NET Compiler Platform (Roslyn) Analyzers inspect your C# or Visual Basic code for style, quality, maintainability, design, and other issues. This inspection or analysis happens during design time in all open files. Analyzers are divided into the following groups: Code style analyzers are built into Visual Studio.

Is Roslyn a compiler?

NET Compiler Platform, also known by its codename Roslyn, is a set of open-source compilers and code analysis APIs for C# and Visual Basic (VB.NET) languages from Microsoft.

Does MSBuild use Roslyn?

MSBuild versions follow Visual Studio versions, so RoslynCodeTaskFactory is available in Visual Studio 2017 version 15.8 and higher.


1 Answers

Take a look at the CompilerPackage sources to see how we install the compiler on your machine when you install the preview VSIX. The trick is we drop some MSBuild files in AppData\Local\Microsoft\MSBuild\12.0\<target name>\ImportAfter. These files are loaded automatically in any C# or VB.NET build. In them, we change the corresponding CscToolPath or VbcToolPath to a path that contains the Roslyn compilers. There's also some additional trickery to deal with multiple hives in the scenario if you had different versions of the compilers installed in different experimental hives in VS.

So if you take a look at that, create those same .target files and edit them to point to some place where you've dropped rcsc and rvbc, it should work.

like image 199
Jason Malinowski Avatar answered Sep 29 '22 03:09

Jason Malinowski