I have the following segment of code.
var script = CSharpScript.Create("int x = 12;");
var result = await script.RunAsync();
var variable = result.GetVariable("x");
int value = (int)variable.Value;
It crashes on the second line with following:
Could not load file or assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
This is a UWP application and I am trying to use the Microsoft.CodeAnalysis.CSharp.Scripting library. I installed the package through NuGet. The app compiles and deploys, but crashes on the second line of this code.
Obviously, the problem is in the System.Core DLL which has a conflicting version between the one deployed with my app (4.6) and the one used by the library (4.0). Does anyone have a solution to this? Is there a way to specify a version of the library to be used or the target framework (even though I am using UWP)?