引用类型''声称它在'System.Web'中定义,但是找不到 [英] Reference to type '' claims it is defined in 'System.Web', but it could not be found

查看:66
本文介绍了引用类型''声称它在'System.Web'中定义,但是找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发.NET Core 2应用程序,我有一个仅用Framework 4.6编写的Nuget程序包.我已经下载了Nuget程序包,最初创建类的实例没有问题.

I'm working on a .NET Core 2 application, I have a Nuget package that I need that is only written in Framework 4.6. I've downloaded the Nuget package and initially there are no problems with creating an Instance of the class.

但是,当我尝试使用其中一种方法时,在VS 2017中出现一个错误,说对类型的引用"声称它是在'System.Web'中定义的,但找不到它',"Module'System.Web,版本= 2.0.0.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a'."

However when I try to use one of the methods I get an error in VS 2017 saying "Reference to type '' claims it is defined in 'System.Web', but it could not be found" , "Module 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' should be referenced".

我已经阅读了几篇文章,指出可能无法引用所需的System.Web.dll.

I've read several posts saying that it may not be possible to reference System.Web.dll which is needed.

但是我也看到了这些:

使用外部.点网核心中的dll

.net核心1.0 Visual Studio引用了外部dll

我尝试将其添加为对项目的引用,以及使用

I've tried adding it as a reference to the project as well as using Nuget Package Explorer to create a Nuget package with System.Web in it.

我可以通过正确引用System.Web.dll来解决此问题,还是在.NET Core 2中无法实现?

Can I solve this issue by correctly referencing the System.Web.dll or is this not possible in .NET Core 2?

推荐答案

在.NET Core 2中无法使用 System.Web 命名空间/dll的API.

It is not possible to use APIs of the System.Web namespace / dlls in .NET Core 2.

虽然可以使用.NET Framework NuGet包和DLL,但是此兼容性层只是尽力而为的方法,如果外部代码尝试使用.NET Core中不可用的API(例如类型),则该兼容性层可能会失败在 System.Web 中.

While it is possible to use .NET Framework NuGet packages and DLLs, this compatibility layer is only a best-effort approach and may fail if the external code tries to use APIs that are not available in .NET Core, such as types in System.Web.

这篇关于引用类型''声称它在'System.Web'中定义,但是找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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