.Net Framework dll 不适用于 .Net Standard 项目 [英] .Net Framework dll not working on .Net Standard project

查看:77
本文介绍了.Net Framework dll 不适用于 .Net Standard 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 .Net 框架 ddl 引用到 .Net 标准 2.0.它将显示以下错误.

I have referenced the .Net framework ddl to .Net standard 2.0. It will show me below errors.

System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types.
The given assembly name or codebase, 'inDebug
etcoreapp2.1FirstDataBank.DrugServer.API.dll', was invalid.
The given assembly name or codebase, 'inDebug
etcoreapp2.1FirstDataBank.DrugServer.API.dll', was invalid.
The given assembly name or codebase, 'inDebug
etcoreapp2.1FirstDataBank.DrugServer.API.dll', was invalid.
The given assembly name or codebase, 'inDebug
etcoreapp2.1FirstDataBank.DrugServer.API.dll', was invalid.'

相同的 ddl 在 .Net 框架项目上运行良好,但对于 .Net 标准,它会显示错误.

Same ddl working fine on .Net framework project but for .Net standard it will show an error.

推荐答案

.Net Framework dll 不适用于 .Net Standard 项目"——嗯,是的;这是正常的,也是意料之中的;如果您需要使用仅适用于 .NET Framework(而非 .NET Standard)的内容,那么:您应该只从本身面向 .NET Framework 的项目中使用它;或者:考虑重新定位或多定位您正在使用的库(如果您控制它;否则:询问供应商),理想情况下,它可以作为针对 .NET Standard 的 nupkg 或多目标使用.NET Framework .NET Standard.

".Net Framework dll not working on .Net Standard project" - well, yes; that's normal and expected; if you need to consume something that is only available for .NET Framework (not .NET Standard), then: you should only be consuming it from a project that itself targets .NET Framework; alternatively: consider re-targeting or multi-targeting the library that you're consuming (if you control it; otherwise: ask the supplier), ideally so that it is available as a nupkg that targets .NET Standard, or that multi-targets .NET Framework and .NET Standard.

这篇关于.Net Framework dll 不适用于 .Net Standard 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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