.Net Framework dll在.Net Standard项目上不起作用 [英] .Net Framework dll not working on .Net Standard project
问题描述
我已将 .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屋!