如何在 .Net Core 1.0 中使用 IronPython
How to use IronPython with .Net Core 1.0
我正在尝试将 IronPython 添加到 .Net Core 1.0 网络应用程序,但无法访问 ScriptRuntime class。当我尝试添加 using IronPython;
时,出现错误提示找不到 IronPython。
我也收到有关 ScriptRuntime does not exist in the current context
的错误
注意: 目前在 OSX 10.11
上使用 Visual Studio 代码
以下是我的 project.json 的依赖项和框架部分:
{
"version": "1.0.0-*",
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.Sqlite": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
"Microsoft.Dnx.Runtime": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Microsoft.NETCore.Platforms": "1.0.1-*",
"Newtonsoft.Json": "8.0.3",
"IronPython": "2.7.5",
"IronPython.StdLib": "2.7.5"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
},
}
在我的控制器中,我有以下使用语句:
using System.IO;
using System.Diagnostics;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json.Linq;
using MatrixSynthesisWebApp.Models;
using System.Dynamic;
using System.Runtime.CompilerServices;
using IronPython;
我认为无法在 .Net Core 上使用 IronPython NuGet 包。该包是为 .Net Framework(和 Silverlight)编译的,这意味着它不能在 .Net Core 中使用。
您可能会考虑在 the project's Github site.
上请求将 IronPython 移植到 .Net Core 中可用的 netstandard
编辑:IronPython NuGet 包的最新版本似乎支持 .Net Core 2.x。所以看起来这现在应该可以工作了。
Svicks 的回答不是当前状态:
IronPython 团队刚刚发布了支持单声道和 .net 核心的 IronPython 2.7.8 测试版:
更多信息在这里:https://github.com/IronLanguages/ironpython2/releases
支持单声道和 .net 核心的 IronPython 3 仍在开发中。
我正在尝试将 IronPython 添加到 .Net Core 1.0 网络应用程序,但无法访问 ScriptRuntime class。当我尝试添加 using IronPython;
时,出现错误提示找不到 IronPython。
我也收到有关 ScriptRuntime does not exist in the current context
注意: 目前在 OSX 10.11
上使用 Visual Studio 代码以下是我的 project.json 的依赖项和框架部分:
{
"version": "1.0.0-*",
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.Sqlite": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
"Microsoft.Dnx.Runtime": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Microsoft.NETCore.Platforms": "1.0.1-*",
"Newtonsoft.Json": "8.0.3",
"IronPython": "2.7.5",
"IronPython.StdLib": "2.7.5"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
},
}
在我的控制器中,我有以下使用语句:
using System.IO;
using System.Diagnostics;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json.Linq;
using MatrixSynthesisWebApp.Models;
using System.Dynamic;
using System.Runtime.CompilerServices;
using IronPython;
我认为无法在 .Net Core 上使用 IronPython NuGet 包。该包是为 .Net Framework(和 Silverlight)编译的,这意味着它不能在 .Net Core 中使用。
您可能会考虑在 the project's Github site.
上请求将 IronPython 移植到 .Net Core 中可用的 netstandard编辑:IronPython NuGet 包的最新版本似乎支持 .Net Core 2.x。所以看起来这现在应该可以工作了。
Svicks 的回答不是当前状态:
IronPython 团队刚刚发布了支持单声道和 .net 核心的 IronPython 2.7.8 测试版:
更多信息在这里:https://github.com/IronLanguages/ironpython2/releases
支持单声道和 .net 核心的 IronPython 3 仍在开发中。