From many examples of compiling a Roslyn SyntaxTree, I have seen code such as:
[... create tree and compilation ...]
var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("foo"), AssemblyBuilderAccess.RunAndCollect);
var module = assembly.DefineDynamicModule("foo");
var result = compilation.Emit(module);
But when I try to do this in the current Roslyn released with Visual Studio 2015 RC, I see no Emit()
which takes a module. I need to write to a stream and load it into a regular AppDomain
-locked Assembly
.
I then see this answer from Tomas Matousek: https://stackoverflow.com/a/22977158
Where he says that this has been removed because it was "problematic".
I am having difficulty finding any other information about this on the Internet. Does anyone know if:
- There is another way in Roslyn to compile into an assembly that can be garbage collected?
- Or this will be supported in the final release of VS / Roslyn?
- Where I should direct this question if nobody here knows (had trouble finding an official, active Roslyn forum)?