在.NET Core 2.0 Preview 1中使用R.NET.Community [英] Using R.NET.Community in .NET Core 2.0 Preview 1

查看:65
本文介绍了在.NET Core 2.0 Preview 1中使用R.NET.Community的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直希望使用 R.NET.Community 在.NET Core应用中。显然,尽管没有将NuGet软件包移植到.NET Core,但这并不是一个开始。但是,使用 .NET Core 2.0预览版1公告,您可以引用.NET Core中的.NET Framework库,我又做了另外一遍:

For a while, I've been hoping to use R.NET.Community in a .NET Core app. Obviously though with the NuGet package not having been ported to .NET Core, that's been a non-starter. However, with the .NET Core 2.0 Preview 1 announcement that you can reference .NET Framework libraries from .NET Core, I gave this another go:

using RDotNet;

namespace RDotNetCore2
{
    class Program
    {
        static void Main(string[] args)
        {
            REngine.SetEnvironmentVariables();
            var engine = REngine.GetInstance();
        }
    }
}

将其创建为.NET新的Visual Studio 2017预览版中的Core 2.0应用程序,它至少可以编译和运行,但是在 GetInstance 调用时出错:

Creating this as a .NET Core 2.0 app in the new Visual Studio 2017 Preview, this at least gets as far as compiling and running, but errors at the GetInstance call:


无法加载文件或程序集'System.Security.Permissions,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = cc7b13ffcd2ddd51'。系统找不到指定的文件。

Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

我可以做些什么来解决此问题,或者只是其中的一部分而已? .NET Core不支持(我怀疑这很可能是由于.NET Core不支持CAS的缘故)?

Is there anything I can do to fix this, or this just one of those bits which isn't supported in .NET Core (which I suspect may be likely due to the fact that CAS isn't supported on .NET Core)?

推荐答案

您确定这是框架版本问题吗?

Are you sure this is a Framework version problem?

没有系统。 .net的4.x版本中的Security.Permissions 文件(尽管存在命名空间)。但是,.net Core 2.0中有一个具有该名称的dll(例如,包含 PrincipalPermissions 类。在.net 4.7中,此类为在 mscorlib.dll 中实现。

There isn't a System.Security.Permissions file in the 4.x version of .net (although there is a namespace). There is a dll with this name in .net Core 2.0, though (containing, for example, the PrincipalPermissions class. In .net 4.7, this class is implemented in mscorlib.dll).

在得出结论之前,值得一看项目参考无法正常工作。如果您可以在其中添加对该dll的引用(大概应该已经在Core 2.0运行时中安装了该引用),则可能会解决此问题。

It's probably worth having a look at your project references before you conclude that this isn't going to work. If you can add a reference there to the dll (which presumably you should have had installed with the Core 2.0 runtime), that might solve the problem.

这篇关于在.NET Core 2.0 Preview 1中使用R.NET.Community的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆