Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3244110
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:30:43+00:00 2026-05-17T18:30:43+00:00

I have the following IronPython code. class Hello: def __init__(self): pass def add(self, x,

  • 0

I have the following IronPython code.

class Hello:
    def __init__(self):
        pass
    def add(self, x, y):
        return (x+y)

I need to call this from C#, and I came up with the following code.

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

class Hello {
    public static void Main()
    {
        ScriptEngine engine = Python.CreateEngine();
        ScriptSource script = engine.CreateScriptFromSourceFile("myPythonScript.py");
        ScriptScope scope = engine.CreateScope();

        script.Execute(scope);
    }
}

After copying IronPython.dll, I run the following command. (I tried to run gacutil, but I got some errors.

 dmcs /r:IronPython.dll callipy.cs

But I got some error messages as follows.

Could not load file or assembly 'Microsoft.Scripting.ExtensionAttribute, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
Missing method .ctor in assembly /Users/smcho/Desktop/cs/namespace/IronPython.dll, type System.Runtime.CompilerServices.ExtensionAttribute
Can't find custom attr constructor image: /Users/smcho/Desktop/cs/namespace/IronPython.dll mtoken: 0x0a000080
Could not load file or assembly 'Microsoft.Scripting.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
Could not load file or assembly 'Microsoft.Scripting.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
Could not load file or assembly 'Microsoft.Scripting.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
...

It seems like that IronPython needs Microsoft.Scipting.Core, but with mono I don’t know what to do?

  • Can C# run IronPython object on Mono? If so, how to do that?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:30:44+00:00Added an answer on May 17, 2026 at 6:30 pm

    IronPython is not a stand-alone DLL. It has some dependencies which should have been shipped with IronPython (they are included in the latest zipped distribution targeting .NET 2.0 — see the IronPython download page):

    IronPython.Modules.dll
    Microsoft.Dynamic.dll
    Microsoft.Scripting.dll
    Microsoft.Scripting.Core.dll
    Microsoft.Scripting.Debugging.dll
    Microsoft.Scripting.ExtensionAttribute.dll
    

    Make sure your project can find these DLLs (which it currently can’t, which is why you’re getting errors). I’ve never tried running IronPython on Mono, but it should work.

    Note that the IronPython release targeting .NET 4.0 doesn’t include (or need) Microsoft.Scripting.Core.dll and Microsoft.Scripting.ExtensionAttribute.dll, since their functionality has been merged into System.Core. See this answer for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this following python code, it works fine in python but fails with
I have the following CPython code which I now try to run in IronPython:
I have written the following IronPython code: import clr clr.AddReference(System.Drawing) from System import *
I want to create an instance of an IronPython class from C#, but my
I have a Python file with as content: import re import urllib class A(object):
I'm trying to use IronPython as an intermediary between a C# GUI and some
In order to write testable C# code, I use DI heavily. However lately I've
I tried to bring a previously done webform made in vb.net to an IronPython
I have a table that, some of its columns are unknown at compile time.
Working on a project that uses some IronPython scripts to as plug-ins, that utilize

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.