peachpiecompiler / peachpie

PeachPie - the PHP compiler and runtime for .NET and .NET Core
https://www.peachpie.io
Apache License 2.0
2.37k stars 203 forks source link

cannot target Xamarin.Mac due to Mono.Posix reference #919

Open jakubmisek opened 3 years ago

jakubmisek commented 3 years ago

When building an application targeting Xamarin.Mac:

Could not install package ‘Mono.Posix.NETStandard 1.0.0’. You are trying to install this package into a project that targets ‘Xamarin.Mac,Version=v2.0’, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Found a workaround (not tested), originally posted on https://forum.groupdocs.com/t/document-merger-net-apis-on-mac-os/8476

Since it cannot be installed, this is out of the way. Solution->Target Framework->Xamarin.Mac Full (.NET framework 4.5). Only 4.5 works as in any other version the References in the project namely “System”, “System.Core” and “Xamarin.Mac” are indicating in Red color. In this case, GroupdDocs.Merger is added successfully via Nuget.

ghost commented 3 years ago

Some additional information: adding the packages works after switching target framework to Xamarin.Mac Full, but the namespace Xamarin.Forms.Platform.MacOS disappears, don't know if this is a bug or intended functionality.

ghost commented 3 years ago

When trying to add a package created with peachpie to a Xamarin.Mac project but i get the following error: Unable to resolve dependency 'SixLabors.Fonts'. Source(s) used: 'nuget.org'. I'm assuming this means that SixLabors.Fonts is not available for Xamarin.Mac

jakubmisek commented 3 years ago

In such a case, the whole "graphics" extension can be excluded from the application.

By default, implicitly, a PeachPie project references Peachpie.App package which includes all the available extensions.

Alter the project file as the following:

<Project Sdk="Peachpie.NET.Sdk">

  <PropertyGroup>
    <DisableImplicitPeachpieReferences>true</DisableImplicitPeachpieReferences>
  </PropertyGroup>

  <ItemGroup>
    <!-- do not reference entire PeachPie.App, only a few libraries are needed -->
    <PackageReference Include="Peachpie.Runtime" Version="$(PeachpieVersion)" />
    <PackageReference Include="Peachpie.Library" Version="$(PeachpieVersion)" />
    <!--PackageReference Include="Peachpie.Library.XmlDom" Version="$(PeachpieVersion)" /-->
    <!--PackageReference Include="Peachpie.Library.Graphics" Version="$(PeachpieVersion)" /-->
    <!--PackageReference Include="Peachpie.Library.Scripting" Version="$(PeachpieVersion)" /-->
  </ItemGroup>

</Project>
ghost commented 3 years ago

Excellent, thanks.