Commit 5472eec
authored
Fixes: https://developercommunity.visualstudio.com/t/Visual-Studio-2022-Community-1785-ver/10577484
Related: #8662
I found the following build performance issue using a .NET Android
project template inside VS Windows:
1. Create a new .NET Android project
2. Open some `AndroidResource` `.xml` file in the Android designer
3. *Every* incremental build appears to rebuild everything!
`obj\Debug\net8.0-android\build.props` appears to be changing between
builds with the change:
```diff
--androidsupportedabis=armeabi-v7a;arm64-v8a;x86;x86_64
++androidsupportedabis=arm64-v8a
```
I narrowed this down to the designer running two targets,
`PrepareResources;_GenerateCompileInputs`:
https://github.com/xamarin/UITools/blob/7b167eae94ae018ab19344d6bfb45a925415e2a7/src/Xamarin.Designer.Android/Xamarin.AndroidDesigner/MSBuildConstants.cs#L32
In this example:
* The designer does *not* mark the build as a "design-time build" with
`-p:DesignTimeBuild=true`. This would have used a design-time `build.props`.
* The designer does *not* pass in the selected Android device.
This code is *ancient*, so I suspect this has just always been an
issue? Perhaps, it only occurs in .NET 6+ projects and not
Xamarin.Android?
Because `$(AndroidSupportedAbis)` is not a "supported" thing in .NET
6+, let's just remove it?
Removing `$(AndroidSupportedAbis)` from this file manually does fix
the problem for me locally:
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\tools\Xamarin.Android.Common.targets
There is also a *second* `adb.props` file that triggers a subset of
things to rebuild if the selected Android device changes:
<WriteLinesToFile
File="$(_AdbPropertiesCache)"
Lines="AdbTarget=$(AdbTarget);AdbOptions=$(AdbOptions)"
Usage of the new property, `$(RuntimeIdentifier)`, also changes
`$(IntermediateOutputPath)`, so I feel like we shouldn't need this
value in `build.props` in a .NET 6+ world.
1 parent 55b47f1 commit 5472eec
File tree
1 file changed
+0
-1
lines changed- src/Xamarin.Android.Build.Tasks
1 file changed
+0
-1
lines changedLines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
967 | 967 | | |
968 | 968 | | |
969 | 969 | | |
970 | | - | |
971 | 970 | | |
972 | 971 | | |
973 | 972 | | |
| |||
0 commit comments