无法从引用的项目中的程序集中加载类型

时间:2019-07-01 08:14:33

标签: c# dll project asp.net-core-webapi

我有两个项目,一个Web api(使用.net核心)和一个类库(使用net 4.5)。 api会引用类库,而该库会执行大部分逻辑,然后将数据返回到api项目。

我的类库中的某个方法使用System.ServiceModel dll,并且我已经在其中引用了它,但是当我的api项目在类库上调用此方法时,它返回一个错误,指出无法找到系统的程序集。 ServiceModel dll。

dll引用如何用于项目?类库中引用的System.Servicemodel dll不正确吗?

我尝试在API项目上添加System.ServiceModel.Primitives,但是出现一个新错误,提示它无法加载类型System.ServiceModel.InstanceContextMode。经检查,此类不包含在原始dll或nuget中可用的任何其他servicemodel dll上

这是我的项目参考的示例结构

>WEB API (net core)
>>References
>>>Projects
>>>>Class Library

>CLASS LIBRARY (net 4.5)
>>References
>>>Assemblies
>>>>System.ServiceModel

0 个答案:

没有答案