简体   繁体   中英

.Net Framework dll not working on .Net Standard project

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.'

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

This simply isn't supported.

You may reference some (but not all) .NET Standard Libraries from a .NET Framework project, but the other way is not supported.

.NET Standard is designed to support code sharing among different platforms, but .NET Framework only supports Windows.

To get you started on the topic, here is a nice post that explains it pretty short: Difference between Standard, Framework and Core

".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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM