-
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
dotnet pack puts net5.0-android in lib/net5.0 instead of lib/net5.0-android #14042
Comments
This was using It seems like something might have changed recently, I think this may have been working on RC 1. |
Can you please attach a binlog? NuGet/NuGet.Client@ba87e7e was recently added to correctly handle the Sounds like you need NuGet/Home#10063, same as the other issue. Keep in mind that target platforms have versions and those have to be included in the package. |
@nkolev92 I retested with .NET 5.0.100-rtm.20509.5. I'm not sure how to tell which NuGet commits are in a .NET build. Here is the |
For some reason this sdk/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets Lines 1033 to 1041 in ee45586
So I tried our prototype Microsoft.Android "workload", and the problem is fixed: So I think we can close this. I believe the new dotnet/sdk workload changes caused this, but everything seems to be working for an actual "workload". We will hopefully have this in place soon. |
I have one question with respect to the <?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>UnnamedProject</id>
<version>1.0.0</version>
<authors>UnnamedProject</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<dependencies>
<group targetFramework="net5.0-android30.0" />
</dependencies>
</metadata>
</package> I'm wondering where the trailing <TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">30</TargetPlatformVersion> I think Android is unique in the fact that this will always be an integer. Should this property generation be updated to always include a trailing |
Reopening this, as we have a related question. We are having to do this to put our <None Include="$(_AarOutputPath)" Pack="true" PackagePath="lib\$(TargetFramework)$(TargetPlatformVersion).0" /> Looking through the |
Not sure at what part exactly the 0 gets appended, but it is there "as written". NuGet itself doesn't understand the platform names and how they correlate with the numbers, so the logic kept is at the minimum a 2 part version similar to the target framework moniker part. |
@jonathanpeppers Can you try adapting this solution (from here)? <PropertyGroup>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);IncludeReferencedProjectInPackage</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>
<Target Name="IncludeReferencedProjectInPackage" Condition="'$(IncludeBuildOutput)' != 'false'">
<GetNuGetShortFolderName
TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
TargetPlatformMoniker="$(TargetPlatformMoniker)">
<Output TaskParameter="NuGetShortFolderName" PropertyName="_NuGetShortFolderName" />
</GetNuGetShortFolderName>
<ItemGroup>
<TfmSpecificPackageFile Include="$(OutputPath)\ReferencedLib.dll" PackagePath="lib/$(_NuGetShortFolderName)" />
</ItemGroup>
</Target> |
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.
This appears to work well: dotnet/android#5242 We can close this, thanks! |
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.
I'm testing an Android library project similar to what we have setup here:
https://github.com/xamarin/net6-samples
I notice that the output of
dotnet pack
on aTargetFramework=net5.0-android
library results in:NOTE: we have an additional .aar file here that is added via
<None Include="$(OutputPath)$(TargetName).aar" Pack="true" PackagePath="lib\$(TargetFramework)" />
. This works fine.The
PackTask
emits a warning, that is probably related:The
PackTask
generates a.nuspec
such as :This might need to be filed against the NuGet repo, not sure.
/cc @dsplaisted
The text was updated successfully, but these errors were encountered: