Skip to content

Pre-build event should run before checking for AndroidManifest.xml (XA1018) #9021

Open

Description

Android framework version

Other

Affected platform version

VS 2022 / net7.0-android

Description

In my Xamarin app, I have a pre-build event that runs a script which generates AssemblyInfo.cs (Windows), Info.plist (iOS) and AndroidManifest.xml (Android) from a template, filling in some version info (i.e. git commit hash, etc). The repo includes the template file, i.e. AndroidManifest.template.xml; AndroidManifest.xml itself is .gitignored, since its contents change with each build.

On Windows & iOS, this works great. However on Android, it seems to check for the existence of AndroidManifest.xml before running the pre-build event, saying:

1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.95\tools\Xamarin.Android.Common.targets(574,3): error XA1018: Specified AndroidManifest file does not exist: D:\Work\USRadar\_Solution_\RadarMP\RadarMP.Android\AndroidManifest.xml.

Since it checks for this before pre-build, the script can't run & generate AndroidManifest.xml from the template. I therefore have to manually create a "dummy" AndroidManifest.xml every time I checkout the repo, just so the first-time build will run the pre-build event & generate the real AndroidManifest.xml. All builds after that work.

How can I get the Android project to run the pre-build event, before checking for that file, similar to Windows & iOS?

Steps to Reproduce

Please see description

Did you find any workaround?

No response

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions