私はここで見つけることができる例をやっています。だから私はC#スクリプトでIronPythonを実行しようとしています:
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");
…
そして、ここからこのエラーが発生します:「ダイナミックオペレーションは「Microsoft.CSharp.dll」アセンブリ参照なしではコンパイルできません。」そして、私はそれが何であるかを真剣に理解していません、私は何を追加するのを忘れましたか?
私の参考文献には次のようなものがあります。
あなたの助けのためのThx。
追伸:私はMonoDevelopを使用しています。