错误CS0246:找不到类型或命名空间名称“WebserverRequest”(您是否缺少using指令或程序集引用?) [英] error CS0246: The type or namespace name 'WebserverRequest' could not be found (are you missing a using directive or an assembly reference?)

查看:561
本文介绍了错误CS0246:找不到类型或命名空间名称“WebserverRequest”(您是否缺少using指令或程序集引用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我使用Visual Studio 2017 professional来构建我的C#项目。 



之前我使用的是目标框架版本".NET Framework 4.6.1",当我构建项目时没有构建问题。



现在根据一些要求,我将Target框架更改为版本".NET Framework 4.0",当我构建时,我收到以下错误:



错误CS0246:找不到类型或命名空间名称"WebserverRequest"(您是否缺少using指令或程序集引用?)



错误CS0246:找不到类型或命名空间名称'APC'(您是否缺少using指令或汇编引用?)



我还将所有依赖项目目标框架版本更改为".NET Framework 4.0"。



这是正确的方法将最新的Target框架版本更改为旧框架版本?

Hi,

I am using Visual Studio 2017 professional to build my C# project. 

Previously i used the Target framework version ".NET Framework 4.6.1", that time when i built the project there was no build issues.

Now based on some requirement, I changed Target framework to version ".NET Framework 4.0" and when i am building I am getting the below errors:

error CS0246: The type or namespace name 'WebserverRequest' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'APC' could not be found (are you missing a using directive or an assembly reference?)

I have also changed all the dependent project Target framework versions to ".NET Framework 4.0".

Is it the correct way to change the latest Target framework version to older framework version?

请帮我解决这些错误。

我还收到以下警告消息:

C:\Program Files \ Microsoft Visual Studio \2017 \Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2106,5):警告MSB3274:主要参考"EnergyUsageManager,Version = 3.0.2.0,Culture = neutral,processorArchitecture = MSIL"
无法解析,因为它是针对".NETFramework,Version = v4.6"而构建的。框架。这是比当前目标框架".NETFramework,Version = v4.0"更高的版本。

C:\Program Files\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3274: The primary reference "EnergyUsageManager, Version=3.0.2.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.6" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

推荐答案

.NET中没有WebserverRequest。这必须是第三方代码或您自己的代码。我猜想EnergyUsageManager。此第三方代码需要.NET 4.6+。因此,您无法将代码降级到之前的版本。它不受支持。

There is no WebserverRequest in .NET. This has to be third party code or your own. I'm guessing EnergyUsageManager. This third party code requires .NET 4.6+. Therefore you cannot downgrade your code to a version before that. It isn't supported.

没有解决方法。您需要将代码保持在4.6+以上,或者将此库的使用替换为在早期版本上运行的内容。

There is no workaround. You either need to keep your code at 4.6+ or replace your usage of this library with something that runs on an earlier version.


这篇关于错误CS0246:找不到类型或命名空间名称“WebserverRequest”(您是否缺少using指令或程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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