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*

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No NuGet package created for binding lib dependency

akwanpdf opened this issue · comments

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:

  • .NET SDK version 6.0.100
  • Visual Studio Community 2022 for Mac Preview, Version 17.0 Preview (17.0 build 4729)
  • macOS Big Sur Version 11.6

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.

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).

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).

Hi! Any update on this?