MonoMac and XamarinMac Target Frameworks

Topics: Ecosystem
Jan 11, 2014 at 1:17 PM

MonoMac and XamarinMac projects currently have a target framework of .NETFramework so it is not possible to have an assembly in a NuGet package that targets MonoMac or XamarinMac.

It is possible to identify MonoMac/XamarinMac projects using the project type guids. There is an open pull request for the Xamarin Studio/MonoDevelop NuGet addin that shows how to identify these projects. As far as I am aware MonoMac and XamarinMac projects will not be changed by Xamarin so they will remain targeting the .NET Framework.

Returning MonoMac or XamarinMac back from NuGet's IProjectSystem TargetFramework property will allow NuGet packages to target these frameworks. However with this change these projects can no longer use NuGet packages that target the .NET Framework or includes PCLs even though these NuGet packages are still compatible.

Ideally we want to support the following:
  1. NuGet packages with XamarinMac or MonoMac specific assemblies being installed into XamarinMac or MonoMac projects.
  2. NuGet packages with .NET Framework assemblies being installed into XamarinMac/MonoMac projects.
  3. NuGet packages with PCLs being installed into XamarinMac/MonoMac projects.
Possible Solution

So we are treating XamarinMac/MonoMac projects as though they support both XamarinMac/MonoMac and also the .NET Framework. NuGet would first try to find any XamarinMac/MonoMac assemblies and then fallback to looking for the standard .NET Framework assemblies. So there is a primary target framework and a fallback target framework.

Is this something that makes sense for NuGet to support or is there another approach?