开发者

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

开发者 https://www.devze.com 2023-03-10 07:40 出处:网络
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.

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 Vis开发者_高级运维ual 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?


You could configure the SearchPath directory

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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消