.Net Framework dll在.Net Standard项目上不起​​作用 [英] .Net Framework dll not working on .Net Standard project

查看:103
本文介绍了.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, '\bin\Debug\netcoreapp2.1\FirstDataBank.DrugServer.API.dll', was invalid.
The given assembly name or codebase, '\bin\Debug\netcoreapp2.1\FirstDataBank.DrugServer.API.dll', was invalid.
The given assembly name or codebase, '\bin\Debug\netcoreapp2.1\FirstDataBank.DrugServer.API.dll', was invalid.
The given assembly name or codebase, '\bin\Debug\netcoreapp2.1\FirstDataBank.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的东西(em.net标准)(而非.NET Standard),则:您应该仅从本身以.NET Framework为目标的项目中使用它;或者:考虑重新定位或将您正在使用的库(如果您控制,则进行多目标;否则:询问供应商),理想情况下,以便将其作为面向.NET Standard或多目标的nupkg可用。 .NET Framework .NET标准。

".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天全站免登陆