我想要的IronPython添加到一个.net 1.0核心的Web应用程序,但有能够访问ScriptRuntime类的问题。当我尝试添加using IronPython;
我得到的错误说,IronPython的找不到。
我也得到约ScriptRuntime does not exist in the current context
错误
注:目前使用Visual Studio代码在OSX 10.11
以下是我project.json的依赖关系和框架部分的T:
{
"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语句:
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;
我认为这是不可能使用IronPython的NuGet包.Net的核心。该包中被编译为.Net框架(和Silverlight),这意味着它不是可用从净核心。
你可能会考虑要求IronPython的被移植到netstandard,这是可用的从.net核心,上the project's Github site。
编辑:看来IronPython的NuGet包支持对.NET核心2.x的最新版本所以它看起来像这样应该现在的工作。
Svicks答案不是当前状态:
IronPython的特攻队刚刚发布的IronPython 2.7.8的测试版支持单声道和.NET的核心:
更多的相关信息在这里:https://github.com/IronLanguages/ironpython2/releases
IronPython的3单声道和.NET核心支持仍在进行中。