简体   繁体   English

从 .Net Core 3 引用 .NET Framework DLL

[英]Referencing .NET Framework DLL from .Net Core 3

I have a .NET Framework library provided by a vendor (CyberSource payment processor - https://github.com/CyberSource/cybersource-sdk-dotnet ).我有一个供应商提供的 .NET Framework 库(Cyber​​Source 支付处理器 - https://github.com/Cyber​​Source/cybersource-sdk-dotnet )。

This API is being referenced by an ASP.NET Core 3.0 application. ASP.NET Core 3.0 应用程序正在引用此 API。

Everything compiles fine but when I attempt to call a method in the .NET Framework library, I get the following exception:一切都编译正常,但是当我尝试调用 .NET Framework 库中的方法时,出现以下异常:

{"Method not found: 'Void System.ServiceModel.EndpointAddress..ctor(System.Uri, System.ServiceModel.EndpointIdentity, System.ServiceModel.Channels.AddressHeaderCollection)'."} {“找不到方法:'Void System.ServiceModel.EndpointAddress..ctor(System.Uri,System.ServiceModel.EndpointIdentity,System.ServiceModel.Channels.AddressHeaderCollection)'。”}

Things I've determined:我确定的事情:

  • Vendor doesn't provide a .NET Core or .NET Standard -compliant library供应商不提供 .NET Core 或 .NET Standard 兼容库
  • Library source is not portable as-is to .NET Standard or .NET Core库源不能按原样移植到 .NET Standard 或 .NET Core

Is there any reasonable way to make this work?有什么合理的方法可以使这项工作?

You can analyze the DLL with The .NET Portability Analyzer .您可以使用.NET Portability Analyzer分析 DLL。 If all classes and methods that the DLL uses are available in .NET Standard/.NET Core then CLR will be able to call those methods.如果 DLL 使用的所有类和方法在 .NET Standard/.NET Core 中都可用,则 CLR 将能够调用这些方法。 But some apis are not yet ported and that can be what you are facing.但有些 api 尚未移植,这可能是您面临的问题。 If that's the case, you may be able to fork and rewrite the code to use APIs available in .NET Core 3.如果是这种情况,您可以分叉并重写代码以使用 .NET Core 3 中可用的 API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从.NET Core引用传统.NET Framework - Referencing Traditional .NET Framework from .NET Core 从.net核心控制台应用程序引用.net标准2.0库中的dll时出错 - Error referencing dll in .net standard 2.0 library from .net core console application 从 Model .net 核心引用 ApplicationUser - Referencing ApplicationUser from Model .net core 完整.NET Framework上ASP.NET Core项目内的NuGet文件夹中的参考DLL - Reference DLL from NuGet folder inside ASP.NET Core project on full .NET framework 从.NET Framework传统项目引用.NET Standard csproj项目 - Referencing .NET Standard csproj project from .NET Framework traditional project 将OwinADAuthentication从.NET Framework转换为.NET Core - Convert OwinADAuthentication from .NET Framework to .NET Core 从类库(.NET Core)引用ASP.NET Core Web应用程序(.NET Core) - Referencing ASP.NET Core Web Application(.NET Core) from Class Library (.NET Core) 如果.Net Core可以在Windows上运行,为什么不能在.Net Framework中引用.Net Core DLL? - If .Net Core can run on Windows, why can't you reference a .Net Core DLL in .Net Framework? 面向.NET Core时引用旧的(完整的.NET Framework)类库 - Referencing old (full .NET Framework) Class Library when targeting .NET Core Docker - 构建 .net 核心可运行项目,引用 .net 框架 4.7.2 项目 - Docker - build .net core runnable project referencing .net framework 4.7.2 projects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM