简体   繁体   English

System.Net,无法解析符号“Net”

[英]System.Net, cannot resolve symbol 'Net'

I'm lost.我迷路了。 My .NET Framework 4.6.2 cannot resolve my using System.Net.我的 .NET Framework 4.6.2 无法解决我使用 System.Net 的问题。 I've added the assembly reference, but is has that yellow warning triangle on the reference.我已经添加了程序集参考,但是参考上有那个黄色警告三角形。 How did I mess this up?我是怎么搞砸的?

Because of other dependencies I'm stuck with 4.6.2由于其他依赖项,我坚持使用 4.6.2

I'm lost.我迷路了。 My .NET Framework 4.6.2 cannot resolve my using System.Net.我的 .NET Framework 4.6.2 无法解决我使用 System.Net 的问题。 I've added the assembly reference, but is has that yellow warning triangle on the reference.我已经添加了程序集参考,但是参考上有那个黄色警告三角形。 How did I mess this up?我是怎么搞砸的?

First , try to install Net Framework 4.6.2 Developer Pack from this link or do a repair in VS Installer in case your net framework 4.6.2 is broken.首先,尝试从此 链接安装 Net Framework 4.6.2 Developer Pack 或在 VS Installer 中进行修复,以防您的net framework 4.6.2损坏。

1) make sure that Target Framework is 4.6.2 by Right-click on your project--> Properties-->Application-->Target Framework is net framework 4.6.2 . 1)确保 Target Framework 是 4.6.2,方法是右键单击您的项目--> Properties-->Application-->Target Framework is net framework 4.6.2

2) run update-package -reinstall under Tools --> Nuget Package Manger --> Package Manager Console to reinstall these nuget packages and their dependencies in case there are in a mess before. 2) run update-package -reinstall under Tools --> Nuget Package Manger --> Package Manager Console to reinstall these nuget packages and their dependencies in case there are in a mess before.

3) close VS Instance, delete bin and obj folder and then restart your project. 3)关闭VS Instance,删除binobj文件夹,然后重新启动你的项目。

4) Actually, system.net dll is a system dll of Net Framework and when you use it, you should search under net framework 4.6.2 . 4)其实system.net dll是Net Framework的系统dll,使用时要在net framework 4.6.2下搜索。

Right-click on Reference-->Add Reference-->choose the v4.6.2 System.Net dll .右键单击 Reference-->Add Reference-->选择v4.6.2 System.Net dll

在此处输入图像描述

Or go through the path C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Net.dll .或 go 通过路径C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Net.dll

Actually , System.Net is a part of System.dll .实际上System.NetSystem.dll的一部分。 And if you have System.dll in your project, you can just using System.Net in code editor without referencing it again.如果您的项目中有System.dll ,您可以在代码编辑器中使用System.Net而无需再次引用它。

In addition , you can enter Error list window , the warning will be listed in that window and it will tell you what is specific problem and if necessary, you can share it with us.此外,您可以输入错误列表 window ,警告将列在 window 中,它会告诉您具体问题,如有必要,您可以与我们分享。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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