Skip to content

Conversation

@jonathanpeppers
Copy link
Member

Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1334066

In traditional Xamarin.Android, a File -> New binding project emits
the warning:

BINDINGSGENERATOR warning BG8601: No '<package>' elements found.

This happens until you add a Java library to actually bind.

The warning doesn't happen in .NET 6 due to the Condition:

<Target Name="_SetAndroidGenerateManagedBindings"
    Condition=" '$(UsingAndroidNETSdk)' != 'true' Or '@(InputJar->Count())' != '0' Or '@(EmbeddedJar->Count())' != '0' Or '@(LibraryProjectZip->Count())' != '0' ">
  <PropertyGroup>
    <!-- Used throughout to determine if C# binding-related targets should skip -->
    <_AndroidGenerateManagedBindings>true</_AndroidGenerateManagedBindings>
  </PropertyGroup>
</Target>

The $(UsingAndroidNETSdk) check makes the value always true in
traditional Xamarin.Android. I think we can just remove this check, as
the Condition has been working well in .NET 6.

I added a new test for this scenario. The warning is gone now.

Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1334066

In traditional Xamarin.Android, a File -> New binding project emits
the warning:

    BINDINGSGENERATOR warning BG8601: No '<package>' elements found.

This happens until you add a Java library to actually bind.

The warning doesn't happen in .NET 6 due to the `Condition`:

    <Target Name="_SetAndroidGenerateManagedBindings"
        Condition=" '$(UsingAndroidNETSdk)' != 'true' Or '@(InputJar->Count())' != '0' Or '@(EmbeddedJar->Count())' != '0' Or '@(LibraryProjectZip->Count())' != '0' ">
      <PropertyGroup>
        <!-- Used throughout to determine if C# binding-related targets should skip -->
        <_AndroidGenerateManagedBindings>true</_AndroidGenerateManagedBindings>
      </PropertyGroup>
    </Target>

The `$(UsingAndroidNETSdk)` check makes the value always true in
traditional Xamarin.Android. I think we can just remove this check, as
the `Condition` has been working well in .NET 6.

I added a new test for this scenario. The warning is gone now.
@jonathanpeppers jonathanpeppers merged commit e244cbf into dotnet:main Oct 18, 2021
@jonathanpeppers jonathanpeppers deleted the nothing-to-bind-warnings branch October 18, 2021 21:36
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants