Skip to content

AndroidManifest can not be set to an absolute path #7243

Description

@SamMonoRT

Description

Copied over from dotnet/runtime#73311
Description
Microsoft.Android.Sdk.DefaultProperties.targets is always settings $(AndroidManifest) to AndroidManifest.xml if empty. Xamarin.Android.Common.targets is settings _AndroidManifestAbs always to $(ProjectDir)$(AndroidManifest) as long as $(AndroidManifest) is not empty.

There is no clean way to set the path to an absolute one (as part of an SDK) besides hooking in before _GetAndroidPackageName and resetting $(AndroidManifest) and defining $(_AndroidManifestAbs) myself. This feels a bit hacky.

Reproduction Steps
Set C:...\AndroidManifest.xml

Expected behavior
'$(_AndroidManifestAbs)' == 'C:...\AndroidManifest.xml'

Actual behavior
'$(_AndroidManifestAbs)' == '$(ProjectDir)C:...\AndroidManifest.xml'

Regression?
No response

Known Workarounds


<_AndroidManifestAbs Condition=" '$(AndroidManifest)' != '' ">$(AndroidManifest)</_AndroidManifestAbs>




Configuration
No response

Other information
No response

Steps to Reproduce

See Description.

@Falco20019 dotnet/maui is already doing exactly what you describe:

https://github.com/dotnet/maui/blob/f1c358800c5276bc16290164eaf98c60f92da9fe/.nuspec/Microsoft.Maui.Controls.SingleProject.targets#L40

Is the problem finding right place to set this value? .NET workloads can probably run .targets in a different order that makes this work.

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.enhancementProposed change to current functionality.possibly-staleIssues that are potentially no longer relevant.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions