Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Roslyn cross platform?

Tags:

c#

roslyn

mono

I've been looking at Roslyn for quite some time now, and I'm curious and excited about it. One thing I noticed is that they mentioned that the compiler is re-written in managed code. This raises the question of whether Roslyn is able to run on non-.NET virtual machines, such as Mono.

I would really love to embed C# scripting using Roslyn in my video games, and to use many of their other features in my applications, but I'm wondering if using Roslyn will break the ability for it to run on Mono.

Has anyone tried running Roslyn on Mono? Is it possible? Why or why not?

To clarify, I'm interested in both whether the managed assembly can run on Mono, and whether it can generate assemblies that mono can run.

like image 466
mirhagk Avatar asked Feb 01 '13 20:02

mirhagk


People also ask

Is Roslyn a part of .NET Core?

Roslyn, the . NET Compiler Platform, empowers the C# compiler on . NET Core and allows developers to leverage the rich code analysis APIs to perform code generation, analysis and compilation.

Why is .NET framework not cross platform?

The main problem is that the implementations can differ from each other, making it hard to run an application on multiple machines out of the box. Source code shouldn't have to be altered, if not some of the libraries are not ported to mono, or different libraries are used.

Is Roslyn open source?

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.

What is Roslyn code generation?

NET Compiler Platform ("Roslyn") SDK. Source Generators let C# developers inspect user code as it is being compiled. The generator can create new C# source files on the fly that are added to the user's compilation. In this way, you have code that runs during compilation.


2 Answers

Despite it being the furthest thing from Eric's mind, Roslyn has been released as true Open Source (Apache 2.0) and is in fact now cross-platform.

Miguel de Icaza of Xamarin showed it running on Mono at BUILD.

When Roslyn releases, it will become part of Mono. They are already maintaining a branch at the Mono Git repo.

like image 190
Justin Avatar answered Sep 19 '22 08:09

Justin


As @Govert has already mentioned in a comment, if you want to embed C# scripting capabilities you should simply use the Mono-equivalent library/tool: Mono-Csharp. (Especially because, even if Roslyn could run on Mono, its licence may dictate that you're not allowed to.)

This tool in the Mono world has existed much earlier than Roslyn BTW, and is open source. Here you have even a Microsoft employee blogging about it and uploading it to Nuget:

http://blog.davidebbo.com/2012/02/quick-fun-with-monos-csharp-compiler-as.html

I hope your game will kick ass!

like image 42
knocte Avatar answered Sep 23 '22 08:09

knocte