Skip to content
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

Cannot create NuGet package using dotnet pack #14708

Closed
SotoiGhost opened this issue Apr 7, 2022 · 2 comments
Closed

Cannot create NuGet package using dotnet pack #14708

SotoiGhost opened this issue Apr 7, 2022 · 2 comments
Labels
bug If an issue is a bug or a pull request a bug fix dotnet An issue or pull request related to .NET (6)
Milestone

Comments

@SotoiGhost
Copy link
Contributor

Steps to Reproduce

  1. Unzip the testcase

  2. Run the following command:

    dotnet pack source/AudienceNetwork/AudienceNetwork.csproj -v:diagnostic -bl:dotnet.binlog > dotnet.log
  3. See the results

Expected Behavior

A generated NuGet package

Actual Behavior

The following error:

/usr/local/share/dotnet/sdk/6.0.201/Sdks/NuGet.Build.Tasks.Pack/buildCrossTargeting/NuGet.Build.Tasks.Pack.targets(221,5): error NU5026: The file '/Users/israelsoto/Downloads/testcase/source/AudienceNetwork/bin/Debug/net6.0-ios/Native.Facebook.AudienceNetwork.manifest' to be packed was not found on disk. [/Users/israelsoto/Downloads/testcase/source/AudienceNetwork/AudienceNetwork.csproj]

Environment

Visual Studio Enterprise 2022 for Mac Preview
Version 17.1 Preview (17.1 build 521)
Installation UUID: 51617c2b-29f2-4751-a5c6-a4509649da98

Runtime
.NET 6.0.3 (64-bit)
Architecture: X64

Roslyn (Language Service)
4.1.0-3.22075.3+592501cbb9c9394072a245c15b3458ff88155d85

NuGet
Version: 6.0.0.262

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/6.0.201/Sdks
SDK Versions:
	6.0.201
	6.0.200
	6.0.102
	6.0.101
	6.0.100
	5.0.406
	5.0.405
	5.0.200
	2.1.818
MSBuild SDKs: /usr/local/share/dotnet/sdk/6.0.201/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	6.0.2
	6.0.1
	6.0.0
	5.0.15
	5.0.14
	5.0.3
	2.1.30

Xamarin.Profiler
Version: 1.7.0.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin Designer
Version: 17.1.5.45
Hash: 3fc68ad07
Branch: remotes/origin/d17-0-vsmac
Build date: 2022-03-23 20:02:44 UTC

Apple Developer Tools
Xcode 13.3 (20102)
Build 13E113

Xamarin.Mac
Version: 8.8.0.0 (Visual Studio Enterprise)
Hash: f10d9e023
Branch: xcode13.3
Build date: 2022-03-15 11:47:34-0400

Xamarin.iOS
Version: 15.8.0.0 (Visual Studio Enterprise)
Hash: f10d9e023
Branch: xcode13.3
Build date: 2022-03-15 11:47:35-0400

Xamarin.Android
Version: 12.3.0.0 (Visual Studio Enterprise)
Commit: xamarin-android/d17-2/d1799a0
Android SDK: /Users/israelsoto/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		12.0 (API level 31)
		11.0 (API level 30)
		10.0 (API level 29)

SDK Command-line Tools Version: 5.0
SDK Platform Tools Version: 31.0.3
SDK Build Tools Version: 30.0.3

Build Information: 
Mono: f34bd77
Java.Interop: xamarin/java.interop/main@05bfece4
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.38.0@ccd83d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@fc3c2ac

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.2.0.29
Hash: 5ff637a
Branch: remotes/origin/main
Build date: 2022-03-23 20:02:49 UTC

Android Device Manager
Version: 0.0.0.1108
Hash: 4afbd2a
Branch: remotes/origin/HEAD
Build date: 2022-03-23 20:02:49 UTC

Build Information
Release ID: 1701000521
Git revision: 3e76379cedf40e42208ab802d9c19b24555659cf
Build date: 2022-03-23 20:00:12+00
Build branch: main
Build lane: main

Operating System
Mac OS X 12.3.0
Darwin 21.4.0 Darwin Kernel Version 21.4.0
    Mon Feb 21 20:34:37 PST 2022
    root:xnu-8020.101.4~2/RELEASE_X86_64 x86_64

Build Logs

dotnet.binlog.zip
dotnet.log

Example Project (If Possible)

testcase.zip

It seems that this was fixed before with the following task:

<!--
Binding projects may include NativeReference items, which makes the 'pack' target want to include a Native.$(AssemblyName).manifest into the NuGet,
which obviously fails because we don't create such a file. So let's remove that file.
Ref: https://github.com/dotnet/msbuild/blob/3a1e456fe227f3e2b190b434578844c31e8bcb4a/src/Tasks/Microsoft.Common.CurrentVersion.targets#L6111-L6118
Ref: https://github.com/dotnet/msbuild/issues/4584
-->
<PropertyGroup>
<GenerateNuspecDependsOn>
$(GenerateNuspecDependsOn);
_RemoveNativeManifestFromPack;
</GenerateNuspecDependsOn>
</PropertyGroup>
<Target Name="_RemoveNativeManifestFromPack">
<ItemGroup>
<_BuildOutputInPackage Remove="@(_BuildOutputInPackage)" Condition="'%(Filename)%(Extension)' == '$(_DeploymentTargetApplicationManifestFileName)'" />
</ItemGroup>
</Target>

but for some reason, it's not being executed. Following the binlog, it seems that all our magic just happens within _WalkEachTargetPerFramework target, but after that, there aren't any other import of Xamarin stuff.

Even when we override the GenerateNuspecDependsOn property using Xamarin.Shared.targets, if you print this property before the GenerateNuspec target (the one that is failing), you will notice that the reassignment didn't happen; even when the logs shows that this property was reassignment correctly.

@rolfbjarne rolfbjarne added the dotnet An issue or pull request related to .NET (6) label Apr 19, 2022
@rolfbjarne rolfbjarne added this to the .NET 6 milestone Apr 19, 2022
@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label Apr 21, 2022
@rolfbjarne
Copy link
Member

rolfbjarne commented Apr 22, 2022

Workaround: use TargetFramework (singular) as opposed to TargetFrameworks (plural) in the csproj:

<TargetFramework>net6.0-ios</TargetFramework>

@rolfbjarne
Copy link
Member

This is a variation of dotnet/msbuild#4584, where we can't work around it, because none of our logic is included in the build.

I've proposed a fix to dotnet/msbuild#4584, so we'll see how that goes and if it's accepted. In the meantime use TargetFramework in the csproj instead of TargetFrameworks.

I'm closing this as a duplicate of dotnet/msbuild#4584.

@ghost ghost locked as resolved and limited conversation to collaborators May 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug If an issue is a bug or a pull request a bug fix dotnet An issue or pull request related to .NET (6)
Projects
None yet
Development

No branches or pull requests

2 participants