xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 514 forks source link

Copying Native WatchApp into App Bundle failed #17534

Closed SprengerS closed 1 year ago

SprengerS commented 1 year ago

Copying a native WatchApp into the bundle will fail because WatchkitStubs could not be copied

"/Users/sprenger_s/source/bluesecur_watch/Hoermann.BleApp.sln" (Hoermann_BleApp_iOS Ziel) (1:2) ->
"/Users/sprenger_s/source/bluesecur_watch/src/Hoermann.BleApp.iOS/Hoermann.BleApp.iOS.csproj" (Standardziel) (20:6) ->
                   (_CoreCreateIpa Ziel) ->                      /usr/local/share/dotnet/x64/packs/Microsoft.iOS.Sdk/16.2.1007/tools/msbuild/iOS/Xamarin.iOS.Common.targets(409,3): error MSB3030: Datei "../../native/Hoermann.BleApp.iOS.Native/output/Hoermann/Debug/watchos/Hoermann.BleApp.iOS.Native.WatchOS.app/_WatchKitStub/WK" konnte nicht kopiert werden, da die Datei nicht gefunden wurde. [/Users/sprenger_s/source/bluesecur_watch/src/Hoermann.BleApp.iOS/Hoermann.BleApp.iOS.csproj]

Steps to Reproduce

  1. Create a Native Watch App
  2. Reference the Watch App via _ResolvedWatchAppReferences
  3. Try to create a build via via, not VS Mac

Expected Behavior

The App building will succeed

Actual Behavior

The App building crashes at the ende of the build process

You fixed the validation for WKWatchkitStubs in https://github.com/xamarin/xamarin-macios/pull/16773, but you forget to remove the dito target from _CoreCreateIpa.

Environment

Version information ``` Visual Studio Community 2022 for Mac Version 17.4.4 (build 12) Installation UUID: 9f77b052-f28d-4561-8205-3bb391d8ec43 Runtime .NET 6.0.12 (64-bit) Architecture: Arm64 Roslyn (Language Service) 4.4.0-6.22578.12+3c6ab8e1715e5b080fb7bb77070810ab71e09387 NuGet Version: 6.3.1.1 .NET SDK (Arm64) SDK: Not installed .NET Runtime (Arm64) Runtime: /usr/local/share/dotnet/x64/dotnet Runtime Versions: 7.0.2 6.0.13 3.1.32 (x64 – Unsupported) Xamarin.Profiler Version: 1.8.0.19 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler Updater Version: 11 Xamarin.Android Version: 13.1.0.1 (Visual Studio Community) Commit: xamarin-android/d17-4/13ba222 Android SDK: /Users/sprenger_s/Library/Android/sdk Supported Android versions: 12.1 (API level 32) 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) 7.0 (API level 24) SDK Command-line Tools Version: 7.0 SDK Platform Tools Version: 33.0.3 SDK Build Tools Version: 32.0.0 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.13 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: 2023-01-24 23:14:11 UTC Android Device Manager Version: 0.0.0.1206 Hash: 886af39 Branch: 886af39 Build date: 2023-01-24 23:14:11 UTC Xamarin Designer Version: 17.4.0.136 Hash: d49c9ff6d3 Branch: remotes/origin/d17-4 Build date: 2023-01-24 23:14:06 UTC Apple Developer Tools Xcode 14.2 (21534) Build 14C18 Xamarin.Mac Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version. Xamarin.iOS Version: 16.1.1.27 (Visual Studio Community) Hash: 933c6c2c9 Branch: xcode14.1 Build date: 2022-11-22 02:00:37-0500 Build Information Release ID: 1704040012 Git revision: 5690bbb844f118ae3d5a7c1a945eab0f4f5f1e4c Build date: 2023-01-24 23:11:53+00 Build branch: release-17.4 Build lane: release-17.4 Operating System Mac OS X 13.2.0 Darwin 22.3.0 Darwin Kernel Version 22.3.0 Thu Jan 5 20:48:54 PST 2023 root:xnu-8792.81.2~2/RELEASE_ARM64_T6000 arm64 ```

Build Logs

wk_copy_failure.log.zip

Example Project (If Possible)

SprengerS commented 1 year ago

Do you have a workaround for this problem? It seems overwriting the _CoreCreateIpa Target is not working anymore in .NET7

ghost commented 1 year ago

Hi @SprengerS. We have added the "need-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/xamarin/xamarin-macios/blob/main/docs/bug-repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

SprengerS commented 1 year ago

I'm sorry. I cannot give you a test Repo. Our Repo is very complicated should not be visible for everybody.

My workaround is now to copy the Watchkitstubs before the WatchApp will be copied and remove them after succeeded WatchKit Copy. The Problem is in _CoreCreateIpa the following Copy Target


<Copy
    SessionId="$(BuildSessionId)"
    Condition="'$(IsMacEnabled)' == 'true' And '$(_WatchOS2AppBundle)' != '' And Exists('$(_WatchOS2AppBundle)\_WatchKitStub\WK')"
    SourceFiles="$(_WatchOS2AppBundle)\_WatchKitStub\WK"
    DestinationFolder="$(DeviceSpecificIntermediateOutputPath)ipa\WatchKitSupport2"
/>
rolfbjarne commented 1 year ago

Could you get a binlog instead?

It would be particularly nice you could do something like this, which should produce an English build log (instead of German build log), which would be much easier to read, since I don't speak German:

$ export LANG=en_US
$ dotnet build /bl:msbuild.binlog /Users/sprenger_s/source/bluesecur_watch/Hoermann.BleApp.sln
ghost commented 1 year ago

Hi @SprengerS. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

SprengerS commented 1 year ago

Hi here is the current binlog msbuild.zip

rolfbjarne commented 1 year ago

This was fixed here: #17004, but only backported for legacy Xamarin projects, not for .NET projects.

I've now backported it, so it should be included in our next .NET service release.