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.
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.
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.
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.
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.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With