Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

error MSB4044: The "CompileEntitlements" task was not given a value for the required parameter "AppBundleDir". #45

Open
rolfbjarne opened this issue Oct 27, 2022 · 17 comments

Comments

@rolfbjarne
Copy link
Member

From @tuyen-vuduc on Wed, 26 Oct 2022 23:10:47 GMT

Steps to Reproduce

  1. Check out the sample code from https://github.com/xbindings/ppriskmagnes-xamarin-ios
  2. Open and build the source code with VSfMac
  3. Check the build output

Expected Behavior

  • Build successfully

Actual Behavior

  • Build failed (happened after upgrading to latest VSfMac)
error MSB4044: The "CompileEntitlements" task was not given a value for the required parameter "AppBundleDir".

Environment

Version information
Visual Studio Community 2022 for Mac Preview
Version 17.4 Preview (17.4 build 2339)
Installation UUID: f7c19561-c1c2-46c1-a720-63423e942bdb

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

Roslyn (Language Service)
4.4.0-3.22505.14+53c4590aabe91a32e33324c5095f7e9ee41dbf78

NuGet
Version: 6.3.1.1

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/6.0.402/Sdks
SDK Versions:
	7.0.100-rc.2.22477.23
	6.0.402
	6.0.401
	6.0.400
	6.0.400-preview.22330.6
	6.0.301
	6.0.300
	5.0.408
	3.1.424
	3.1.423
	3.1.422
	3.1.421
	3.1.420
	3.1.419
MSBuild SDKs: /Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	7.0.0-rc.2.22472.3
	6.0.10
	6.0.9
	6.0.8
	6.0.6
	6.0.4
	5.0.17
	3.1.30
	3.1.29
	3.1.28
	3.1.27
	3.1.26
	3.1.25

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

Updater
Version: 11

Apple Developer Tools
Xcode 14.0.1 (21336)
Build 14A400

Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400

Xamarin.iOS
Version: 16.0.0.72 (Visual Studio Community)
Hash: 6756a1146
Branch: release/6.0.4xx-xcode14
Build date: 2022-09-21 08:51:06-0400

Xamarin Designer
Version: 17.4.0.136
Hash: d49c9ff6d3
Branch: remotes/origin/d17-4
Build date: 2022-10-20 22:12:15 UTC

Xamarin.Android
Version: 13.1.0.1 (Visual Studio Community)
Commit: xamarin-android/d17-4/13ba222
Android SDK: /Users/tuyen/Library/Android/sdk
	Supported Android versions:
		12.1 (API level 32)
		8.0  (API level 26)
		12.0 (API level 31)
		11.0 (API level 30)
		10.0 (API level 29)
		9.0  (API level 28)
		13.0 (API level 33)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.3
SDK Build Tools Version: 33.0.0 rc3

Build Information: 
Mono: a96bde9
Java.Interop: xamarin/java.interop/d17-4@fcc33ce2
SQLite: xamarin/sqlite/3.39.3@23e1ae7
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@0be567a

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.4.0.54
Hash: 6eabb9e
Branch: remotes/origin/d17-4
Build date: 2022-10-20 22:12:20 UTC

Android Device Manager
Version: 0.0.0.1206
Hash: 886af39
Branch: 886af39
Build date: 2022-10-20 22:12:20 UTC

Build Information
Release ID: 1704002339
Git revision: 6be3e052a8e0f67b543f4ffc6d23094ed1dd9b9e
Build date: 2022-10-20 22:10:07+00
Build branch: release-17.4
Build lane: release-17.4

Operating System
Mac OS X 12.6.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
    Mon Aug 22 20:17:10 PDT 2022
    root:xnu-8020.140.49~2/RELEASE_X86_64 x86_64

Build Logs

MSBuild version 17.3.2+561848881 for .NET
Build started 10/27/2022 6:01:34 AM.
     1>Project "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/ppriskmagnes-ios.sln" on node 1 (Clean target(s)).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Debug|Any CPU".
     1>Project "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/ppriskmagnes-ios.sln" (1) is building "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj" (2) on node 1 (Clean target(s)).
     2>Project "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj" (2) is building "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj" (2:2) on node 1 (Clean target(s)).
     2>CoreClean:
         Creating directory "obj/Debug/xamarin.ios10/".
       _CleanBindingResourcePackage:
         Directory "bin/Debug/xamarin.ios10/PPRiskMagnes.iOS.resources" doesn't exist. Skipping.
       _CleanIntermediateToolOutput:
         Directory "obj/Debug/xamarin.ios10/actool" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/assetpacks" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/codesign" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/coremlc" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/ibtool" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/ibtool-link" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/ibtool-manifests" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/ipa" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/metal" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/optimized" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/scntool" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/TextureAtlas" doesn't exist. Skipping.
         Directory "obj/Debug/xamarin.ios10/mtouch-cache" doesn't exist. Skipping.
         Removing directory "obj/Debug/xamarin.ios10/".
     2>Done Building Project "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj" (Clean target(s)).
     2>Project "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj" (2) is building "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj" (2:3) on node 2 (Clean target(s)).
     2>CoreClean:
         Creating directory "obj/Debug/net6.0-ios/".
       _CleanBindingResourcePackage:
         Directory "bin/Debug/net6.0-ios/PPRiskMagnes.iOS.resources" doesn't exist. Skipping.
       _CleanIntermediateToolOutput:
         Directory "obj/Debug/net6.0-ios/actool" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/assetpacks" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/codesign" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/coremlc" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/ibtool" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/ibtool-link" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/ibtool-manifests" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/ipa" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/metal" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/optimized" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/scntool" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/TextureAtlas" doesn't exist. Skipping.
         Directory "obj/Debug/net6.0-ios/mtouch-cache" doesn't exist. Skipping.
         Removing directory "obj/Debug/net6.0-ios/".
     2>Done Building Project "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj" (Clean target(s)).
     2>Done Building Project "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj" (Clean target(s)).
     1>Done Building Project "/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/ppriskmagnes-ios.sln" (Clean target(s)).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.94
  Determining projects to restore...
  Restored /Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj (in 195 ms).
MSBuild version 17.3.2+561848881 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
/usr/local/share/dotnet/sdk/6.0.402/Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Drawing.Common.dll". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj]
  PPRiskMagnes.iOS -> /Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/bin/Release/net6.0-ios/PPRiskMagnes.iOS.dll
  PPRiskMagnes.iOS -> /Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/bin/Release/xamarin.ios10/PPRiskMagnes.iOS.dll
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.Shared.targets(648,3): error MSB4044: The "CompileEntitlements" task was not given a value for the required parameter "AppBundleDir". [/Volumes/ws/bindings/paypal-ppriskmagnes-ios-binding/PPRiskMagnes.iOS/PPRiskMagnes.iOS.csproj]

Example Project (If Possible)

https://github.com/xbindings/ppriskmagnes-xamarin-ios

Copied from original issue dotnet/macios#16489

@rolfbjarne
Copy link
Member Author

From @rolfbjarne on Thu, 27 Oct 2022 14:33:20 GMT

Looks like this is a bug in Xamarin.Legacy.Sdk, a legacy binding project should import this:

<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" />

and not:

<Import Project="$(MSBuildExtensionsPath)/Xamarin/iOS/Xamarin.iOS.CSharp.targets" />

Ref:

<Import Project="$(_LegacyExtensionsPath)/Xamarin/iOS/Xamarin.iOS.CSharp.targets" Condition=" '$(_FixupsNeeded)' == 'true' " />
<Import Project="$(MSBuildExtensionsPath)/Xamarin/iOS/Xamarin.iOS.CSharp.targets" Condition=" '$(_FixupsNeeded)' != 'true' " />

@jonathanpeppers
Copy link
Member

@tuyen-vuduc I've heard that MSBuild.Sdk.Extras can multi-target .NET 6+ and Xamarin. Does that work for you instead?

@tuyen-vuduc
Copy link

@jonathanpeppers My project is based on Google APIs for iOS repo.

It is used to be compiled well about a week ago, but failed when I tried again this week after VSfMac upgrade (not sure if any issues with the upgrade).

I also checked out MSBuild.SDK.Extras, but it shows another error.

msbuild.sdk.extras/3.0.44/Build/Workarounds.targets(27,5): error : If you are building projects that require targets from full MSBuild or MSBuildFrameworkToolsPath, you need to use desktop msbuild ('msbuild.exe') instead of 'dotnet build' or 'dotnet msbuild'

@tuyen-vuduc
Copy link

tuyen-vuduc commented Oct 27, 2022

One thing to note: if the native framework is not a Swift one, the binding project will be compiled well. E.g. Kount for iOS

@jonathanpeppers
Copy link
Member

The difference between the two SDKs:

  • MSBuild.Sdk.Extras - requires .NET framework/Mono MSBuild - so you'll have to use msbuild command-line and change the setting in VS Mac for this
  • Xamarin.LegacySdk - requires dotnet build command-line or the VS Mac setting to enable dotnet build

Xamarin.Legacy.Sdk we really only use for building the AndroidX libraries, so it is pretty Android-focused. The iOS & Mac support, I believe was just a community contribution.

@tuyen-vuduc
Copy link

@jonathanpeppers Can you advise where can I change the setting in VSfMac to use MSBuild.Sdk.Extras in this case?

@jonathanpeppers
Copy link
Member

I don't see the setting in VS Mac 17.4 preview anymore, maybe they do it automatically depending on the project type now?

I would try to get msbuild working for MSBuild.Sdk.Extras, and then decide which route to take.

Alternatively, you could have two different projects instead of multi-targeting.

@tuyen-vuduc
Copy link

tuyen-vuduc commented Oct 29, 2022

@jonathanpeppers I tried to get back to a normal Xamarin.iOS binding library. It's compile well on VSfM but cannot pack using dotnet pack

Any advices?

error MSB4019: The imported project "/usr/local/share/dotnet/sdk/6.0.402/Xamarin/iOS/Xamarin.iOS.ObjCBinding.CSharp.targets" was not found.

@tuyen-vuduc
Copy link

For the above, I have to manually create nuspec file then run nuget pack

If use binding template for net6-ios, I faced a new error

 error NETSDK1139: The target platform identifier ios was not recognized.

here is dotnet workload in my machine

Installed Workload Ids      Manifest Version      Installation Source
---------------------------------------------------------------------
wasm-tools                  6.0.10/6.0.400        SDK 6.0.400        
maui-maccatalyst            6.0.541/6.0.400       SDK 6.0.400        
maui-ios                    6.0.541/6.0.400       SDK 6.0.400        
maui-android                6.0.541/6.0.400       SDK 6.0.400        
ios                         16.0.523/6.0.400      SDK 6.0.400        
maui                        6.0.541/6.0.400       SDK 6.0.400        
android                     32.0.476/6.0.400      SDK 6.0.400  

@tuyen-vuduc
Copy link

@jonathanpeppers Can you advise how I can download the previous version of VSfM? I mean each minor version. I want to go back to the version it works for me previously.

@rolfbjarne
Copy link
Member Author

@tuyen-vuduc I believe you'll need an earlier version of Xamarin.iOS (and not necessarily VSfM). Earlier versions of Xamarin.iOS can be found here: https://github.com/xamarin/xamarin-macios/blob/main/DOWNLOADS.md

@tuyen-vuduc
Copy link

Do you think it relates to Xamarin.iOS and XCode 14?

Xamarin.iOS
Version: 16.0.0.72 (Visual Studio Community)
Hash: 6756a1146
Branch: release/6.0.4xx-xcode14
Build date: 2022-09-21 08:51:06-0400

@rolfbjarne
Copy link
Member Author

Yes, this is likely due to changes we've made in Xamarin.iOS 16 (or even earlier).

@tuyen-vuduc
Copy link

tuyen-vuduc commented Nov 7, 2022

@rolfbjarne @jonathanpeppers Have you guys found any things?

I think for this one we will need to only the check for AppBundleDir in one of our targets if the current project type is an app. I don't know where it is, but the idea comes from this post .

Do you think it's an easy fix?

@tuyen-vuduc
Copy link

I tried

<_RequireCodeSigning>false</_RequireCodeSigning>
<EnableCodeSigning>false</EnableCodeSigning>

The other error is shown up

error MSB4044: The "MTouch" task was not given a value for the required parameter "AppBundleDir".

For a reason, when binding a swift library, app bundle creation was enabled.

@tuyen-vuduc
Copy link

Can we skip by checking IsBindingProject is true?

@tuyen-vuduc
Copy link

This happens if and only if I add this package Xamarin.Swift. The workaround is to remove it from binding library for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants