xamarin / Xamarin.Legacy.Sdk

Starting from a .NET 6 project, adds the ability to target legacy Xamarin target frameworks such as monoandroid11.0 or xamarin.ios10. *Not fully supported*
MIT License
34 stars 6 forks source link

No NuGet package created for binding lib dependency #31

Open akwanpdf opened 2 years ago

akwanpdf commented 2 years ago

Describe the bug When building an Android NET6 app that uses a Xamarin.Legacy.Sdk binding library in terminal, no NuGet package is created even though GeneratePackageOnBuild is true.

Meanwhile, when building an Android NET6 app that uses a Microsoft.NET.Sdk binding library in terminal, a NuGet package is properly created when GeneratePackageOnBuild is true.

Steps to Reproduce the Problem I've created a minimal working example of this bug at TestXamarinLegacySdk. Please follow these steps to run the example.

Expected behavior A NuGet package should be created.

Context:

Please let me know if this is intentional behaviour, if there is anything wrong with the example, or if there is another method necessary to generate the package. Thank you.

jonathanpeppers commented 2 years ago

Does this still happen if you're only building net6.0-android as a single $(TargetFramework)? (remove any monoandroid)

One thing you could try as a workaround is to add a target like:

<Target Name="_ForcePack" DependsOnTargets="Pack" AfterTargets="Build" Condition=" '$(TargetFramework)' == '' " />

Basically just forcing this new target to trigger a Pack on the "outer" build that builds all $(TargetFrameworks).

akwanpdf commented 2 years ago

Thanks for the response!

This issue does not happen when I only build net6.0-android as a single $(TargetFramework). It doesn't occur when I only build monoandroid11.0 as a single $(TargetFramework) either.

For the workaround, unfortunately when building UseJavaBinding, the only value of TargetFramework that ever occurs is net6.0-android so the Pack is never triggered. This "outer" build that builds all $(TargetFrameworks) isn't happening in terminal (although it does occur when building in VS Mac).

akwanpdf commented 2 years ago

Hi! Any update on this?