How to configure VS 2015 to enable Roslyn C # scripting features?
I tried installing various Nuget packages, including versions 1.0 and 1.1.0 beta of Microsoft.CodeAnalysis.CSharp, Microsoft.CodeAnalysis.Scripting.CSharp, etc., but I can not get any of the examples I found online for work. I get "type not found" errors, i.e.
var scriptEngine = new ScriptEngine ();
... failed because the type "ScriptEngine" was not found.
Can anyone provide as a recipe, which includes which nuget packages for installation, which use operators, are required, etc. for implementing Roslyn scripts?
UPDATE # 1:
I have made some progress, but still have problems. I get a bunch of compiler warnings, and then a TypeInitilizationException, which seems to be due to component version mismatch.
Now I use the following sample code (taken from the test), and there are no missing types:
using System; using Microsoft.CodeAnalysis.Scripting.CSharp; namespace RoslynScriptingTest { class Program { static void Main(string[] args) { var script = CSharpScript.Create("1 + 2"); var fn = script.CreateDelegate(); var value = fn(); Console.WriteLine("value={0}", value.ToString()); } } }
I downloaded all the nightly packages available at https://www.myget.org/F/roslyn-nightly/ .
I get a series of build warnings that are related to Microsoft.CodeAnalysis, v1.1.0.0.
Running exe, despite the warnings, throws the TypeInitilizationException mentioned above. Based on stacktrace, TypeInitializationError is caused by a version mismatch for System.Reflection.Metadata.dll.
I'm not sure where to go from here. I do not understand how the packages / components related to the scripts fit together. I saw several posts earlier this year that fully described the construction of Roslin. I didnβt do it. It's necessary?
This reminds me of a hellish DLL from ancient times.