4
votes

My Xamarin.Forms project targetting .NETStandard 1.4 and importing portable is having problems with System-references.

Imported the relevant portable profile and System NuGet packages for .NETCore but Xamarin.Forms (PCL) will not accept them.

Is there a work around to this?

{
  "supports": {},
  "dependencies": {
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "NETStandard.Library": "1.6.0",
    "System.ComponentModel": "4.0.1",
    "System.Diagnostics.Tools": "4.3.0-preview1-24530-04",
    "System.Resources.ResourceManager": "4.3.0-preview1-24530-04",
    "System.Runtime.Serialization.Primitives": "4.1.1",
    "Prism.Core": "6.2.1",
    "Prism.Forms": "6.2.0",
    "Prism.Unity.Forms": "6.2.0",
    "Xamarin.Forms": "2.3.2.127"
  },
  "frameworks": {
    "netstandard1.4": {
      "imports": "portable-net45+win81"
    }
  }
}

Get build errors like this:

The type 'IEditableObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ComponentModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

...and this:

The type name 'GeneratedCodeAttribute' could not be found in the namespace 'System.CodeDom.Compiler'. This type has been forwarded to assembly 'System.Diagnostics.Tools, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly.

1
Same problem here :(Juan Antonio Cano
I believe Xamarin.Forms as a whole will require .Net Standard 2.0 to be fully compatible. You can see this on the table here: docs.microsoft.com/en-us/dotnet/articles/standard/library Until then you should just use a PCL and then convert the PCL to netstandard20 when it comes out.Jon Douglas
Unfortunately, it looks like Xamarin doesn't fully support .NET Standard yet (see this related answer: stackoverflow.com/a/40954744/999428 ). However, I found a working .NET Standard 1.1 proof-of-concept Xamarin solution here: github.com/adamped/XamarinForms.NetStandard if 1.1 is sufficient for what you're trying to accomplish.Ryan Russon
I'm getting this same problem. I've never had this problem before. I've been compiling and running my Xamarin Forms app on Android, iOS, and UWP for months, and now, after an uninstall and reinstall of Windows 10/ Visual Studio, my Xamarin Forms project has stopped compiling.Christian Findlay
Ryan is correct that Xamarin does not support .NET Standard, but I can see from this project.json that the project imports "portable-net45+win81" which means that the project will support Xamarin Forms.Christian Findlay

1 Answers

1
votes

I upgraded to Visual Studio 2017 and this problem went away.