Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] FileWrites&libraryprojectimports.cache (#…
…7780) On occasion we see the following error when building a Maui app: MyMauiApp/Platforms/Android/AndroidManifest.xml : error APT2260: resource style/Maui.SplashTheme (aka com.companyname.mymauiapp:style/Maui.SplashTheme) not found. Looking in detail at the build log we notice that *none* of the resources in the `$(IntermediateOutputPath)\lp` folder are being included in the call to `aapt2`. Looking further we see: Skipping target "_ResolveLibraryProjectImports" because all output files are up-to-date with respect to the input files. … Task "ReadLibraryProjectImportsCache" (TaskId:184) Task Parameter:CacheFile=obj/Debug/net7.0-android/libraryprojectimports.cache (TaskId:184) Task ReadLibraryProjectImportsCache (TaskId:184) CacheFile: obj/Debug/net7.0-android/libraryprojectimports.cache (TaskId:184) obj/Debug/net7.0-android/libraryprojectimports.cache does not exist. No Project Library Imports found (TaskId:184) Done executing task "ReadLibraryProjectImportsCache". (TaskId:184) In this case it seems that the `.cache` file which stores the list of resource directories was created, but was then deleted later on! A search of our build system shows that `libraryprojectimports.cache` was never added to the `@(FileWrites)` ItemGroup. As a result `libraryprojectimports.cache` gets deleted, but the `.stamp` file which controls `_ResolveLibraryProjectImports` is left in place. We end up in a situation where the target which generates the cache will *never* run again because its stamp file is present. Only a full Clean will fix this issue. Fix this situation by updating the `_ResolveLibraryProjectImports` target to add `libraryprojectimports.cache` to the `@(FileWrites)` group, which prevents MSBuild from (occasionally) deleting the file on [incremental clean][0]. [0]: https://github.com/xamarin/xamarin-android/blob/6cd0d38989178e1c3e5e1d71505b4aef26a1739b/Documentation/guides/MSBuildBestPractices.md#filewrites-and-incrementalclean
- Loading branch information