Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[One .NET] place .aar files in NuGet packages properly
Context: dotnet/sdk#14042 (comment) We had been using an unfortunate hack to get the proper directory for placing `.aar` files in NuGet packages: <None Include="$(_AarOutputPath)" Pack="true" PackagePath="lib\$(TargetFramework)$(TargetPlatformVersion).0" /> Not only was the `.0` weird, but it would also produce the wrong result if the `$(TargetFramework)` was `net5.0-android30`: lib\net5.0-android3030.0 Using an example from the NuGet team, we can run a run a target by setting `$(TargetsForTfmSpecificContentInPackage)`: <PropertyGroup> <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_IncludeAarInNuGetPackage</TargetsForTfmSpecificContentInPackage> </PropertyGroup> Then we can run the `<GetNuGetShortFolderName/>` MSBuild task to get the NuGet folder name: <GetNuGetShortFolderName TargetFrameworkMoniker="$(TargetFrameworkMoniker)" TargetPlatformMoniker="$(TargetPlatformMoniker)"> <Output TaskParameter="NuGetShortFolderName" PropertyName="_NuGetShortFolderName" /> </GetNuGetShortFolderName> Lastly, we add to the `@(TfmSpecificPackageFile)` item group: <ItemGroup> <TfmSpecificPackageFile Include="$(_AarOutputPath)" PackagePath="lib\$(_NuGetShortFolderName)" /> </ItemGroup> Using these changes we can remove the `@(None)` item we were using originally. I also updated a test to verify that `net5.0-android30` works.
- Loading branch information