Problems implementing IronPython in C # (missing member requires Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember 'member

I am trying to make a simple hello world to test IronPython implementation in C #, but it seems to be unable to solve this problem.

This is my C # file;

using System; using IronPython.Hosting; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; using System.IO; public class dynamic_demo { static void Main() { var ipy = Python.CreateRuntime(); dynamic test = ipy.UseFile(@"../../Test.py"); test.Simple(); } } 

And this is the python class;

 import sys def Simple(): print 'Hello from Python' print "Call Dir(): " print dir() print "Print the Path: " print sys.path 

My target .NET platform is 4.0, and I am using IronPython 2.6 ..

I get 2 errors when I run this file from a file named "CSC"; Error 5 Missing required compiler member

'Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember' C: \ Users \ Tolga \ documents \ visual studio 2012 \ Projects \ WindowsFormsApplication1 \ consoleTest \ CSC consoleTest

Another from a C # file created by me

Error 6 One or more of the types required to compile a dynamic expression could not be found. You did not find Help? C: \ Users \ Tolga \ documents \ visual studio 2012 \ Projects \ WindowsFormsApplication1 \ consoleTest \ Program.cs 17 9 consoleTest

Here is the output from the assembly

 1>------ Build started: Project: consoleTest, Configuration: Debug Any CPU ------ 1>CSC : warning CS1685: The predefined type 'System.Runtime.CompilerServices.CallSite' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\IronPython 2.6\Microsoft.Scripting.Core.dll' 1>CSC : warning CS1685: The predefined type 'System.Runtime.CompilerServices.CallSite' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\IronPython 2.6\Microsoft.Scripting.Core.dll' 1>CSC : warning CS1685: The predefined type 'System.Runtime.CompilerServices.CallSiteBinder' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\IronPython 2.6\Microsoft.Scripting.Core.dll' 1>CSC : warning CS1685: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll' 1>CSC : error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember' 1>C:\Users\Tolga\documents\visual studio 2012\Projects\WindowsFormsApplication1\consoleTest\Program.cs(17,9,17,20): error CS1969: One or more types required to compile a dynamic expression cannot be found. Are you missing a reference? ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 
+42
python c # dynamic ironpython
01 Oct.
source share
2 answers

You need to add the link to Microsoft.CSharp.dll . This provides the required types for using dynamic in C #.

In addition, you will most likely have to upgrade to IronPython 2.7 [.3] or later, as there are some incompatibilities with older versions and new .NET platforms.

+118
01 Oct
source share

You will also get this error if you have included links to incorrect attack builds . For example, if you are creating a .Net 4.0 Full Profile against, you must include IronPython assemblies from:

 <install directory>\IronPython 2.7\Platforms\Net40 

Enabling assemblies from the Net35 directory Net35 also result in no RuntimeBinder error.

+3
Dec 10 '13 at 18:17
source share



All Articles