0

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; 
 }
}`
Leo Liu
  • 71,098
  • 10
  • 114
  • 135
test test
  • 1
  • 3
  • Please share your code example – ElasticCode Apr 04 '18 at 15:15
  • Example `Using System.Net; namespace code { public class Example { public HttpStatusCode HttpResponse; }}` – test test Apr 04 '18 at 17:22
  • The version 2.0.5.0 indicates that you might still use the legacy PCL projects. Upgrade to .NET Standard 2.0 please, https://xamarinhelp.com/upgrade-pcl-net-standard-class-library/ That can save you from tons of problems. – Lex Li Apr 05 '18 at 04:13
  • Thanks I appreciate the help, I'll test this out but put on hold for now. I have another project that working on. Will try it again probably within a couple of days. – test test Apr 05 '18 at 14:03
  • Please separate this two questions. Only put the linq part here and for http make a new question. This way ppl would be better able to understand the actual question. – MCoder Apr 05 '18 at 14:27

3 Answers3

2

You need just to add System.Core to your References.

1

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.

MCoder
  • 113
  • 5
  • Thanks a very good answer! Sorry but it's a failure on my part to specify. This doesn't work for all the errors. I have same message for 'HttpStatusCode' which is under 'System.Net' (version 2.0.5.0). Prior, I have installed the package for System.Net (version 3.9.0.0) which has the 'HttpStatusCode' under System.Net.Primitives and when I reference it does not work. – test test Apr 04 '18 at 15:26
  • System.Net.Primitives* (version 3.9.0.0) – test test Apr 04 '18 at 15:34
  • It stored on different place in this version for some reason. – test test Apr 04 '18 at 15:34
  • So what is the final status? are you able to solve the linq assembly problem or not? – MCoder Apr 04 '18 at 17:36
  • I tried adding the package via nuget packet manager and it still broken.The linq one works though. – test test Apr 04 '18 at 20:18
  • edit for clarification: linq one works through direct reference, not System.Net.Primitives – test test Apr 05 '18 at 13:55
0

Add this .nuget to your Solution. Micosoft.Net.Http.Check Here.

Krunal Bagadia
  • 419
  • 2
  • 8