-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[question] Android's implementation of multiple $(RuntimeIdentifiers) #14359
Comments
What assets do you need from the RID-specific builds? Is it just the contents of the runtime packs? If so it may be a lot simpler to call the ResolveRuntimePackAssets task directly rather than having inner builds with the RuntimeIdentifier specified. |
We also need to run There is some differences in
I think for a .NET 5 console app, only |
Do you have to run ILLink separately for each RuntimeIdentifier? What is the structure of the output that you want? Do you want separate output folders for each RuntimeIdentifier, or a single folder that has all of the assets for all of the RuntimeIdentifiers? |
Yes, we are running What we need in the end is the layout of the
Where We put architecture-specific assemblies in a folder that matches the Android abi name. At runtime, we have native code that looks for assemblies in the specific subdirectory. We could have used
|
I forgot we had a related discussion before: #11975 |
Not only ILLink needs to run for each RID also native linker should run for each RID |
@jonathanpeppers, this is an old issue, is there still more needed here or any open questions? Or should we close this? |
We can close this, I'm not sure if there are any plans for the dotnet/sdk to support multiple RIDs. If that ever comes, we should use the new built-in thing instead of the solution we have now. |
This is related to: #9795
Android has the requirement of building multiple architecture
.apk
or.aab
files. Using our Android workload, you can put the following in your.csproj
file:In fact, if you omit
$(RuntimeIdentifiers)
(singular or plural), we default toandroid.21-arm64;android.21-x86
. This allows the project to run on most devices and emulators.The way we implemented this was somewhat complicated, and required several "hacks".
After
Build
, we call a target that depends onResolveReferences;ComputeFilesToPublish
:We then use
@(ResolvedFileToPublish)
to do other post-ILLink
work, and produce the.apk
or.aab
file.Some examples of "hacks" and problems we have to workaround
One issue is
$(IntermediateOutputPath)
isobj\Debug\net5.0-android
in the outer build, and the$(RuntimeIdentifier)
is appended in the inner builds.IncrementalClean
from running in the inner builds:Because
$(IntermediateOutputPath)
changes, potentially many files would get deleted.@(IntermediateAssembly)
and@(_DebugSymbolsIntermediatePath)
item groups:@(ResolvedFileToPublish)
contains many .NET assemblies that are completely duplicate. In fact, I had to write an MSBuild task that looks at the MVID of each assembly and deduplicate them.See the full implementation here.
Is there a better way to accomplish what we are trying to do? Should there be some new feature in dotnet/sdk that would also address #9795?
Thanks!
/cc @dsplaisted @jonpryor
The text was updated successfully, but these errors were encountered: