dotnet pack puts net5.0-android in lib/net5.0 instead of lib/net5.0-android
See original GitHub issueI’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 a TargetFramework=net5.0-android
library results in:
> 7z l .\bin\Release\UnnamedProject.1.0.0.nupkg
...
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2020-10-08 10:55:52 ..... 508 287 _rels\.rels
2020-10-08 10:55:52 ..... 456 263 UnnamedProject.nuspec
2020-10-08 15:55:50 ..... 5632 2450 lib\net5.0\UnnamedProject.dll
2020-10-08 15:55:52 ..... 3345 3116 lib\net5.0-android\UnnamedProject.aar
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:
C:\Program Files\dotnet\sdk\5.0.100-rc.2.20480.7\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(207,5): warning NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:
- Add a dependency group for net5.0-android to the nuspec
The PackTask
generates a .nuspec
such as :
> cat .\obj\Release\UnnamedProject.1.0.0.nuspec
<?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" />
</dependencies>
</metadata>
<files>
<file src="C:\src\xamarin-android\bin\TestDebug\temp\DotNetPack\bin\Release\net5.0-android\UnnamedProject.dll" target="lib\net5.0\UnnamedProject.dll" />
<file src="C:\src\xamarin-android\bin\TestDebug\temp\DotNetPack\bin\Release\net5.0-android\UnnamedProject.aar" target="lib\net5.0-android\UnnamedProject.aar" />
</files>
</package>
This might need to be filed against the NuGet repo, not sure.
/cc @dsplaisted
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
dotnet pack command - .NET CLI
The dotnet pack command builds the project and creates NuGet packages. The result of this command is a NuGet package (that is, a...
Read more >Assets file obj\project.assets.json doesn't have a target
1 to net5.0. One of the answers here pointed me in the right direction: The publish profile still had netcoreapp3.1 as target framework....
Read more >Visual Studio for Mac offline installer - Developer Community
I am facing problem in live installation. I have tried at least four times since last night (in at least 18 hours) but...
Read more >EAVFW.Extensions.Manifest.SDK 3.0.0-dev.3
Extensions.Manifest.ManifestEnricherTool. A DotNET CLI tool for expanding and enriching manifest.json. Install the tool locally. Build the project in Release ...
Read more >Are you supposed to target .net standard or dot net 5?
NET Standard existed to allow multi-targeting between multiple .NET versions and runtimes. We now only have a single runtime -- .NET 5 --...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jonathanpeppers Can you try adapting this solution (from here)?
This appears to work well: https://github.com/xamarin/xamarin-android/pull/5242
We can close this, thanks!