Closed jonathanpeppers closed 1 week ago
Can this also add some sort of @(EnableAndroidPackagingOptions)
property users can use to opt out of this?
Apparently this does not opt out of them:
<ItemGroup>
<AndroidPackagingOptionsExclude Remove="@(AndroidPackagingOptionsExclude)" />
</ItemGroup>
and they have to put it behind a target instead, which makes it very hard for most users to figure out how to opt-out:
<Target Name="_Foo" BeforeTargets="_PrepareBuildApk">
<ItemGroup>
<AndroidPackagingOptionsExclude Remove="@(AndroidPackagingOptionsExclude)" />
</ItemGroup>
</Target>
The idea of AutoImport.props
, it is before your project, and you can override/clear them:
<AndroidPackagingOptionsExclude Remove="DebugProbesKt.bin" />
<!-- Or just all of them -->
<AndroidPackagingOptionsExclude Remove="@(AndroidPackagingOptionsExclude)" />
My example above should work in .NET 9, maybe it doesn't work in .NET 8?
Back then @(AndroidPackagingOptionsExclude)
was declared somewhere else?
That's what I thought, but apparently it doesn't work in this case. Do you think maybe it was caused by the issue you are fixing in this PR and they will now be clearable without needed a target?
/azp run
Ok, there's an outage apparently:
/azp run
One of the "gotchas" with
AutoImport.props
, is the file is imported by literally all .NET projects. Even .NET 8 and .NET 9 Android projects import their files on top of each other...This means every
<ItemGroup>
needs aCondition
that checks:is this Android?
is this the expected .NET framework version?
<ItemGroup>
s inAutoImport.props
should have, something like:$(EnableDefaultAndroidItems)
checks also work for some cases, but .NET MAUI turns this off in favor of their own wildcards:https://github.com/dotnet/maui/blob/f269ef3de701043910c941bbbfcbdb7422cc245c/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.SingleProject.Before.targets#L10