简体   繁体   中英

Mac Visual Studio Xamarin - the type or namespace 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)

On Mac Visual Studio - Xamarin Project, I get an error:

  • the type or namespace 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference)

I have tried to resolve it by using the nuget package manager. Specifically, click 'Packages' folder and click 'Add Packages...' and add Linq. Yet it still does not find Linq when I write 'using System.Linq' yet I can see 'System.linq' in the package folder under the project.

Tried : Refresh, Update, turn off and on

Why can't it find and use the package?

Edit: For similiar error 'HttpStatusCode' where it not found under 'System.Net' yet I have the dll (Version 2.0.5.0) found. I tried to install a new nuget package for it, System.Net.Primitives (Version 3.0.9.0) where 'HttpStatusCode' is stored under this new version. When I reference System.Net.Primitives it does not work.

Example:

'\\ The type or namespace name 'Primitives' does not exist in the namespace 'System.Net'
Using System.Net.Primitives;
Using System.Net;
namespace code {
 public class Example
 {
  \\ the type or namespace 'HttpStatusCode' could not be found
  public HttpStatusCode HttpResponse; 
 }
}`

In one of my project I solved it by following way:

Open solution explorer. Right click references, Click on assemblies, select system.xml.linq.

Add the reference assembly to the project. Clean and rebuild. It should serve the purpose.

Add this .nuget to your Solution. Micosoft.Net.Http. 在这里检查。

您只需要将System.Core添加到您的References

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