0

I have referenced HttpStatusCode via System.Net in a Portable Class Library.

I then need to reference that status code from a MonoDroid project that includes that PCL. I understand that the System.Net namespace exists in the System DLL for MonoDroid and this has been included.

However this results in a build error:

 CS0012: The type 'System.Net.HttpStatusCode' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

Now I realise there are strong namespacing issues with referencing the PCL System.Net, and that there is a Shim DLL in MvvmCross.PortableSupport that is supposed to resolve this issue. I have included MvvmCross.PortableSupport.3.0.8.1\lib\MonoAndroid16\System.Net.dll to the MonoDroid project, but I still get the same error.

What am I missing?

Thanks!

Matthew

MisterMat
  • 197
  • 1
  • 9

1 Answers1

0

So I was unable to determine the underlying issue, but the workaround was to avoid referencing the System.Net symbol from the native code via the Portable Class Library (framework 104 btw)

In this instance, instead of exposing the HttpStatusCode from the PCL, I exposed it as an integer and thus worked around the problem.

Stuart is away on holiday at the moment but he suggested this as a workaround and it works fine. It's not clear why the shim System.Net.Dll that MvvmCross includes isn't redirecting the reference correctly to the native library.

MisterMat
  • 197
  • 1
  • 9