Closed
Description
Android application type
.NET Android (net7.0-android, net8.0-android, etc.)
Affected platform version
VS2022 17.8.5
Description
The NET8 Android binding library generates it sources files at obj\$(Configuration)\$(TargetFramework)\generated\src
.
When the resources of the corresponding app are updated by MSBuild:UpdateGeneratedFiles
the msbuild target PrepareResources
is called, which deletes the generated sources.
When debugging this causes problems, because the source has changed.
Building the application fails if resources files are open.
Steps to Reproduce
- Create NET8 Android binding library for an .AAR file
- Use the binding library in a application as project reference
- Build the application
- Check the binding library generated source at
obj\$(Configuration)\$(TargetFramework)\generated\src
- Open the app Android resource and change it
- Watch
obj\$(Configuration)\$(TargetFramework)\generated\src
, the source will be deleted after some delay. - While debugging (hitting a break point) the hot reload window is displayed, because the source files have been deleted.
Did you find any workaround?
Create a file Directory.Build.targets
in the Android binding library project directory
<Project>
<Target Name="PrepareResources" DependsOnTargets="$(PrepareResourcesDependsOn)" Condition="'$(DesignTimeBuild)'!='true'">
<Message Text="PrepareResources modified" Importance="High" />
</Target>
</Project>
Add to all projects in the solution:
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
This disables the resource update in the Android binding library
Relevant log output
No response