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] fix cases of missing
@(Reference)
(#7642
) Fixes: dotnet/maui#10154 Context? dotnet/maui#11364 If you have a solution setup with: * `ApplicationA.csproj` has a `@(ProjectReference)` to `LibraryB.csproj`. * `LibraryB.csproj` which has a `@(Reference)` to `LibraryC.dll`, built by- * `LibraryC.csproj` The app will crash at runtime, due to a missing `LibraryC.dll`. The workaround is for `LibraryB.csproj` to use `@(ProjectReference)` to `LibraryC.csproj` instead of `@(Reference)` to `LibraryC.dll`. However, it appears the same situation works in a .NET 7 self-contained console app: % dotnet publish --self-contained -r win-x64 … % ls -1 .\bin\Debug\net7.0\win-x64\publish\LibraryC.dll LibraryC.dll The underlying issue appears to be due to [`$(_FindDependencies)`][0]: <_FindDependencies Condition="'$(BuildingProject)' != 'true' and '$(_ResolveReferenceDependencies)' != 'true'">false</_FindDependencies> In the console app, `$(BuildingProject)`=true and `$(_FindDependencies)` is empty. In the Android app, `$(BuildingProject)`=false and `$(_FindDependencies)` is `false`. It appears that the `BuildOnlySettings` target *should* be running in Android apps when we do an "inner" build per `$(RuntimeIdentifier)`. Simply updating `_ComputeFilesToPublishForRuntimeIdentifiers` so that the `BuildOnlySettings` target is in `DependsOnTargets` fixes this. However, this also causes satellite assemblies to now be automatically found by the .NET SDK. Update `@(_AndroidResolvedSatellitePaths)` so that `@(ReferenceSatellitePaths)` is only included on Classic builds, preventing duplicate entries. [0]: https://github.com/dotnet/msbuild/blob/a2490dd3f78cce4abc8f9e6f1b5268437332818f/src/Tasks/Microsoft.Common.CurrentVersion.targets#L2322
- Loading branch information