Muhammad Alkarouri
Muhammad Alkarouri

Reputation: 24672

How to use a C# class library from an IronPython app in Visual Studio?

I am a new user of Visual Studio, and I am trying to figure out how to load a C# class library built as part of a solution from an IronPython project in the same solution.

Basically, I am trying to do the scenario in How to debug a class library in Visual Studio but using an IronPython script instead of the console application.

Normally outside a solution I would use:

import clr
clr.AddReferenceToFile(fname)

What should I put in for fname?

Upvotes: 1

Views: 601

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039418

You could configure the SearchPath directory

enter image description here

and then:

clr.AddReference("NameOfAssembly")

or you could also specify the full path:

clr.AddReferenceToFileAndPath(@"c:\work\someproject\bin\debug\NameOfAssembly.dll")

Here's a blog post describing the different functions for loading assemblies in IronPython.

Upvotes: 2

Related Questions