如何将 IronPython 与 Visual Studio 2008 结合使用

发布于 2024-07-13 05:27:29 字数 114 浏览 7 评论 0 原文

我尝试过使用 Microsoft 提供的 IronPython 集成扩展。 但它不适用于 Visual Studio 2008。IronPython

是否有合适的 VS 2008 IDE 扩展?

I've tried using the IronPython integration extension provided by Microsoft. But it does not work with Visual Studio 2008.

Is there a proper VS 2008 IDE extension for IronPython?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

银河中√捞星星 2024-07-20 05:27:29

对于 IronPython 1.1 支持(其语法镜像 CPython 2.4),我成功构建并安装了来自 Visual Studio 2008 SDK 1.0 以及 Visual Studio 2008 SP1 专业版。 它适用于从 Standard 到 Team Suite 的任何版本。 由于 Express 内置的限制,它肯定无法与 Express Edition 一起使用。

对于 IronPython 2.0(其语法镜像 CPython 2.5),目前没有在 Visual Studio 2008 下编写和调试的好方法,不幸的是,适应 IronPython Studio 来托管 IronPython 2.0——IronPython 2.0 的重大更新之一是使其基于 动态语言运行时,这打破了以前使用的静态编译等启用 IntelliSense 的技巧。

For IronPython 1.1 support (whose syntax mirrors CPython 2.4), I successfully built and installed the sample from the Visual Studio 2008 SDK 1.0 with the Professional Edition of Visual Studio 2008 SP1. It will work with any edition from Standard up to Team Suite. It definitely won't work with Express Edition due to limitations built in to Express.

For IronPython 2.0 (whose syntax mirrors CPython 2.5), there is currently no good way to write and debug under Visual Studio 2008, and unfortunately, it would be a significant undertaking to adapt IronPython Studio to host IronPython 2.0--one of the big updates in IronPython 2.0 was to base it on the Dynamic Language Runtime, and this breaks the tricks for enabling IntelliSense that were used previously such as static compilation.

一身软味 2024-07-20 05:27:29

目前,没有可在 Visual Studio 上运行 IronPython v2.0 的扩展。

Right now, there is no extension to run IronPython v2.0 on Visual Studio.

枫以 2024-07-20 05:27:29

我对 VS2008 和 IronPython 都很陌生(但不是 Python 本身):但在我看来,我确实像是在 VS 2008 Pro 下运行 IronPython 2.0.1,尽管方式相当麻烦。

  1. 请按照 http://blogs.msdn.com/ 中的说明进行操作aaronmar/archive/2006/02/16/533273.aspx,进行一些修改:在 MS 网站上搜索 VS 2008 SDK,因此 IronPythonIntegration 解决方案的路径略有不同(但可预测)地方。
  2. 接下来 - “然后,只需按 CTRL+F5 进行构建和运行即可。这将使用“实验配置单元”启动 Visual Studio。”。 是的,这会在第一个实例之上启动另一个 VS 实例,但幸运的是,您只需等待第一次构建过程即可。

其余的说明对我有用:我构建了一个简单的测试控制台应用程序,它按我的预期工作。 不过,我还没有尝试过任何 .Net 的东西。

现在,如果有一种简单的方法来更改 sys.path 以使用普通的 Python 库......

I'm new to both VS2008 and IronPython (but not Python itself): but it sure looks to me like i'm running IronPython 2.0.1 under VS 2008 Pro, albeit in a rather cumbersome fashion.

  1. Follow the instructions at http://blogs.msdn.com/aaronmar/archive/2006/02/16/533273.aspx, with some modifications: search the MS website for the VS 2008 SDK instead, and the path to the IronPythonIntegration solution is therefore in a slightly different (but predicatable) place.
  2. Following on -- "Then, it should simply be a matter of hitting CTRL+F5 for Build & Run. This will launch Visual Studio using the "Experimental hive".". Yes, this launches another VS instance on top of the first one, but thankfully you only have to wait through the build process the first time.

The rest of the instructions worked for me: i built a simple test console app, and it worked as i expected. I haven't tried any .Net stuff yet, though.

Now if there were just an easy way to change sys.path to use the normal Python libraries ...

酒中人 2024-07-20 05:27:29
string code = @"100 * 2 + 4 / 3";

ScriptEngine engine = Python.CreateEngine();
ScriptSource source =
  engine.CreateScriptSourceFromString(code, SourceCodeKind.Expression);

int res = source.Execute<int>();
Console.WriteLine(res);

有关完整的教程和示例代码,请查看以下链接:

使用 IronPython 扩展 C# 应用程序

http://blogs.microsoft.co.il/blogs/berniea/archive/2008/12/04 /extending-your-c-application-with-ironpython.aspx

string code = @"100 * 2 + 4 / 3";

ScriptEngine engine = Python.CreateEngine();
ScriptSource source =
  engine.CreateScriptSourceFromString(code, SourceCodeKind.Expression);

int res = source.Execute<int>();
Console.WriteLine(res);

For the complete tutorial and example code, check out the following link:

Extending your C# application with IronPython

http://blogs.microsoft.co.il/blogs/berniea/archive/2008/12/04/extending-your-c-application-with-ironpython.aspx

给不了的爱 2024-07-20 05:27:29

如果您只是想在 ASP .NET 网站中使用 IronPython(不支持的项目),请查看 如何安装 Microsoft ASP.NET Futures(2007 年 7 月)

If you are just looking at using IronPython in ASP .NET websites (projects not supported), check out how to install Microsoft ASP.NET Futures (July 2007)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文