-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Xamarin.Android.Build.Tasks] add missing Condition
in AutoImport.props
#9463
[Xamarin.Android.Build.Tasks] add missing Condition
in AutoImport.props
#9463
Conversation
…props` 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 a `Condition` that checks: * is this Android? * is this the expected .NET framework version? `<ItemGroup>`s in `AutoImport.props` should have, something like: <ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' and $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '9.0')) "> `$(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
Can this also add some sort of 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 <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 |
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 |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
…9463) 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 a `Condition` that checks: * Is this Android? * Is this the expected .NET framework version? `<ItemGroup>`s in `AutoImport.props` should have, something like: <ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' and $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '9.0')) "> `$(EnableDefaultAndroidItems)` checks also work for some cases, but [.NET MAUI turns this off in favor of their own wildcards][0]. [0]: https://github.com/dotnet/maui/blob/f269ef3de701043910c941bbbfcbdb7422cc245c/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.SingleProject.Before.targets#L10
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