-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AndroidManifest can not be set to an absolute path #7243
Comments
As mentioned here, dotnet/maui is already doing this: dotnet/runtime#73311 (comment) @Falco20019 did you take a look at what they are doing: Does it work if you try something like this? |
Hi @Falco20019. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
AFAIK |
@Falco20019 can you give some details why you need the |
We have a custom SDK that we use that contains a default manifest, setting some stuff that all of our apps need. Every app is then only adding more stuff using the manifest attributes. Since the SDK is usually located in the NuGet package cache (which is not always on the same drive), we need to define the path based on the package path. In our case, we have an encrypted virtual drive on that our code is located. The NuGet package cache on the other side is usually in the user directory and therefore on the system drive. Due to that, it's not possible for us to calculate a relative path to use based on both paths, as the relative path has to include the drive letter, making it an absolute path. More details: It's a highly configurable and modular application. Therefore, all modules are separate NuGet packages themselves. When publishing the customer specific app, we basically have a bootstrapper (one package) and the customer needed modules (more packages) that are referenced in a deployment project, which does not have any code itself. The .NET toolchain needs to have the manifest to be defined in that project as you know. To keep it code-less, we need to add this and other default files through the SDK. That leads to the aforementioned issue with possibly having different drives involved. All other parts of the .NET toolchain have no issues with absolute paths. So this is the only place that behaves "out of order". |
What is an example of the values you need to put in the |
AFAIK, the build chain requires one manifest file as part of your APK building project. It has to be at least existing and empty. Otherwise I got an error. But I must not have any files beside the csproj and possible files absolutely referenced by the SDK. |
So you have a project that builds multiple apps, with the same manifest? Could you have a nearly empty manifest in the app, and then any of the NuGets / class libraries you use pass the specific parts you want set in the final manifest? |
We already define mostly everything through the C# attributes per module and rely on the merger. We only put the basic information like package id into the dummy file. Just to make the tool chain happy. If it's possible to completely avoid adding a file and only rely on attributes, that's also fine for us. It would be best, if we could add the basic manifest into one of the module nupkgs and don't have one in the deployment project at all. Do I have to set a property for this to work? Because if I only tried to rely on the merger without adding at least an empty file to my project, it told me it's missing that file. |
We were considering making it where you wouldn't need an (But this is probably a .NET 8/future thing if it happens) Would something like this work?
Then the default |
If the |
Description
Copied over from dotnet/runtime#73311$(AndroidManifest) to AndroidManifest.xml if empty. Xamarin.Android.Common.targets is settings _AndroidManifestAbs always to $ (ProjectDir)$(AndroidManifest) as long as $(AndroidManifest) is not empty.
Description
Microsoft.Android.Sdk.DefaultProperties.targets is always settings
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
The text was updated successfully, but these errors were encountered: