1

If I understand correctly Xamarin shared project allows us to share code between Xamarin mobile projects (Android, iOS, Windows Phone).

What are the options if I need to share source files between Xamarin projects and some other project types (like WPF or GTK)? I do not use Eto Forms because it does not support all required for my project platforms.

Is "Add as Link" single available option in this case?

Maxim
  • 13,029
  • 6
  • 30
  • 45
  • You can create a portable project which your platform specific projects can reference. I have a solution with a portable project. It has an XForms project and a WPF project which both reference the portable project. It then has an Android project and an iOS project which both reference the XForms project. It works quite nicely. – Slepz Feb 24 '17 at 23:48
  • But I have project which cannot reference regular .Net library project. For example Bridge.Net. – Maxim Feb 24 '17 at 23:58

1 Answers1

1

Just now I have tried all available for me project types.

Probably I can claim that Shared Project is supported by at least the following project types:

1) Xamarin (obvious).
2) WPF application.
3) Regular .Net class library.
4) Portable library.
5) Bridge.NET project.

And not supported for:

1) .Net Core projects. We have to use project.json to include files:

"buildOptions": {
  "compile": {
    "include": [
      "../../SharedProject1/**/*.cs"
    ]
  }
}

Alternatively we have to wait VS 2017 which works.
And I recommend to check MonoDevelop and Xamarin Studio.

As some temporary trick we can include Shared Project into regular .Net library and that library into .Net Core project.

2) Another Shared project. They cannot be nested.. so hierarchy of projects like it is for regular projects is not possible. But it makes sense when abstraction is distributed on several projects.

Maxim
  • 13,029
  • 6
  • 30
  • 45