SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Compiling an IronPython application w/ References

Last post 06-14-2011 6:36 PM by MattWard. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-13-2011 2:55 PM

    Compiling an IronPython application w/ References

    Hello -

    I am writing a program in IronPython that uses uses a dll provided by CQG.  

    Originally, I was using clr.AddReferenceToFileAndPath in my code to reference the dll directly and was running the program from the command line using 'ipy'.

    Now, I am trying to build the project to an exe, and added the CQG dll to the list of Project References (Add Reference > .Net Assembly Browser, etc).  The reference appears as Interop.CQG.  I have tried using 'import CQG' and 'import Interop.CQG', but I get "Could not add reference to assembly ######" errors.  Could I be missing prerequistite clr call before calling import?


  • 06-13-2011 8:38 PM In reply to

    Re: Compiling an IronPython application w/ References

    You should not need to use the clr object if you are compiling your IronPython to an executable. Is the Interop.CQG.dll in the same directory as your exe? Also is that Interop.CQG.dll generated when you added a COM reference or did that file already exist?

  • 06-13-2011 9:39 PM In reply to

    Re: Compiling an IronPython application w/ References

    I acquired the Interop.CQG.dll file from the company CQG.  The dll currently resides in a directory outside of my project, but I have added a reference to it.  However, when I run a build on my project, Interop.CQG.dll is copied to my Debug directory alongside my exe.

    Per your suggestion, I removed importing the clr object, but I have left the references and the 'import CQG' line.  Now I get the following error: "Error: No module named CQG".

  • 06-14-2011 6:36 PM In reply to

    Re: Compiling an IronPython application w/ References

    Cannot reproduce this with SharpDevelop 3 or 4. I downloaded one of the CQG sample applications, extracted the Interop.CQG.dll file, created a new IronPython console application, added a reference to Interop.CQG.dll, then added the following code to

    print "Before import"
    import CQG
    print "After import"

    a = CQG.CQGConditionClass()
    print a.ToString()

    Compiled the application and then ran it directly from the bin\debug folder and the import worked. I got an error when creating the condition class since I didn't have any CQG components installed but no import error.

    I am wondering if you are trying to run the exe from SharpDevelop. By default it will use ipy.exe and not run the exe so you can debug the code. When using ipy you would need to use the clr object. You can run the exe directly if you change the project options but you will not be able to debug the code.

Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this ( email address.