How to use IronPython with Visual Studio 2008
Asked Answered
D

6

12

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?

Deflected answered 2/2, 2009 at 4:21 Comment(0)
T
7

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.

Tactics answered 26/2, 2009 at 1:34 Comment(0)
S
4

Have you tried the IronPython Studio for VS 2008 Shell

Seiden answered 2/2, 2009 at 4:28 Comment(0)
P
1

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

Polloch answered 2/2, 2009 at 5:43 Comment(0)
J
1

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 ...

Jesus answered 15/5, 2009 at 22:29 Comment(0)
O
0
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

Oberhausen answered 11/2, 2009 at 18:42 Comment(0)
G
0

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)

Gabby answered 17/3, 2009 at 5:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.