C# dynamische Kompilierung und "Microsoft.CSharp.dll" Fehler

Mache ich das Beispiel gefunden werden kann,hier.
So versuche ich zu laufen, IronPython in einem C# - script:

Python:

def hello(name):
    print "Hello " + name + "! Welcome to IronPython!"
    return

def add(x, y):
    print "%i + %i = %i" % (x, y, (x + y))
    return

def multiply(x, y):
    print "%i * %i = %i" % (x, y, (x * y))
    return

C#:

using IronPython.Hosting;
using IronPython.Runtime;
using Microsoft.Scripting.Hosting;
using System;

namespace IntroIronPython
{
    class IronPythonMain
    {
        static void Main(string[] args)
        {
            //Create a new ScriptRuntime for IronPython
            Console.WriteLine("Loading IronPython Runtime...");
            ScriptRuntime python = Python.CreateRuntime();

            try
            {
                //Attempt to load the python file
                Console.WriteLine("Loading Python File...");
                //Create a Dynamic Type for our Python File
                dynamic pyfile = python.UseFile("PythonFunctions.py");
                Console.WriteLine("Python File Loaded!");

                Console.WriteLine("Running Python Commands...\n");

                //Call the hello(name) function
                pyfile.hello("Urda");
                

... Und von hier habe ich diesen Fehler:
"Im dynamischen Betrieb nicht kompiliert werden kann, ohne "Microsoft.CSharp.dll" assembly reference".
Und ich ernsthaft nicht verstehen, was das ist, was ich vergessen habe hinzufügen?

In meine Referenzen, die ich habe:
C# dynamische Kompilierung und

Thx für deine Hilfe.

Ps: ich bin auf MonoDevelop.

InformationsquelleAutor ssx | 2012-07-10
Schreibe einen Kommentar