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

Xcode 14 Native Watch App _WatchKitStub/WK could not be copied #16142

Closed
SprengerS opened this issue Sep 27, 2022 · 6 comments · Fixed by #16773
Closed

Xcode 14 Native Watch App _WatchKitStub/WK could not be copied #16142

SprengerS opened this issue Sep 27, 2022 · 6 comments · Fixed by #16773
Labels
need-attention An issue requires our attention/response
Milestone

Comments

@SprengerS
Copy link

We have added a native WatchOS APP for our main App in the csproj file via _ResolvedWatchAppReferences Build target. This works on Xcode 13 very good, but not on Xcode 14. The native Watch App does not contain the WatchkitStub any more, so copying the native App will fail with the following message:

"/Users/sprenger_s/source/bluesecur_test/Hoermann.BleApp.sln" (Hoermann_BleApp_iOS Ziel) (1) ->
"/Users/sprenger_s/source/bluesecur_test/src/Hoermann.BleApp.iOS/Hoermann.BleApp.iOS.csproj" (Standardziel) (2) ->
(_CoreCreateIpa Ziel) -> 
  /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(420,3): error MSB3030: Datei "../../native/Hoermann.BleApp.iOS.Native/output/Hoermann/Release/watchos/Hoermann.BleApp.iOS.Native.WatchOS.app/_WatchKitStub/WK" konnte nicht kopiert werden, da die Datei nicht gefunden wurde. [/Users/sprenger_s/source/bluesecur_test/src/Hoermann.BleApp.iOS/Hoermann.BleApp.iOS.csproj]

Steps to Reproduce

  1. Create native Watch OS App
  2. Dito must copy the App via the _ResolvedWatchAppReferences

Expected Behavior

Actual Behavior

Building fails with the following error:

"/Users/sprenger_s/source/bluesecur_test/Hoermann.BleApp.sln" (Hoermann_BleApp_iOS Ziel) (1) ->
"/Users/sprenger_s/source/bluesecur_test/src/Hoermann.BleApp.iOS/Hoermann.BleApp.iOS.csproj" (Standardziel) (2) ->
(_CoreCreateIpa Ziel) -> 
  /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(420,3): error MSB3030: Datei "../../native/Hoermann.BleApp.iOS.Native/output/Hoermann/Release/watchos/Hoermann.BleApp.iOS.Native.WatchOS.app/_WatchKitStub/WK" konnte nicht kopiert werden, da die Datei nicht gefunden wurde. [/Users/sprenger_s/source/bluesecur_test/src/Hoermann.BleApp.iOS/Hoermann.BleApp.iOS.csproj]

Environment

Version information
Visual Studio Community 2022 for Mac
Version 17.3.5 (build 0)
Installation UUID: 80f3f977-05b7-4f99-8778-46c76dd0548e

Runtime
.NET 6.0.5 (64-bit)
Architecture: Arm64

Roslyn (Language Service)
4.3.0-3.22312.2+52adfb8b2dc71ed4278debcf13960f2116868608

NuGet
Version: 6.2.1.2

.NET SDK (Arm64)
SDK: Not installed

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Versions:
	6.0.6
	6.0.5
	6.0.4
	6.0.3
	6.0.2
	6.0.1
	5.0.17 (x64 – Unsupported)
	5.0.16 (x64 – Unsupported)
	5.0.15 (x64 – Unsupported)
	5.0.14 (x64 – Unsupported)
	5.0.13 (x64 – Unsupported)
	3.1.28 (x64 – Unsupported)
	3.1.27 (x64 – Unsupported)
	3.1.26 (x64 – Unsupported)
	3.1.25 (x64 – Unsupported)
	3.1.24 (x64 – Unsupported)
	3.1.23 (x64 – Unsupported)
	3.1.22 (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.0.0.0 (Visual Studio Community)
Commit: xamarin-android/d17-3/030cd63
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)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.3
SDK Build Tools Version: 32.0.0

Build Information: 
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-3@7716ae53
SQLite: xamarin/sqlite/3.38.5@df4deab
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6

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.3.0.23
Hash: 965bf40
Branch: remotes/origin/d17-3
Build date: 2022-09-09 03:49:37 UTC

Android Device Manager
Version: 0.0.0.1169
Hash: fafb1d5
Branch: fafb1d5
Build date: 2022-09-09 03:49:37 UTC

Xamarin Designer
Version: 17.3.0.208
Hash: 0de472ea0
Branch: remotes/origin/d17-3
Build date: 2022-09-09 03:49:29 UTC

Apple Developer Tools
Xcode 14.0 (21335)
Build 14A309

Xamarin.Mac
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

Xamarin.iOS
Version: 15.99.0.464 (Visual Studio Community)
Hash: 9a839d6c4
Branch: xcode14
Build date: 2022-09-13 05:38:29-0400

Build Information
Release ID: 1703050000
Git revision: ff0de72f31c7c2eccb19854fbaf050fa3f713a7c
Build date: 2022-09-09 03:47:01+00
Build branch: release-17.3
Build lane: release-17.3

Operating System
Mac OS X 12.6.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
    Mon Aug 22 20:19:52 PDT 2022
    root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64


Build Logs

Example Project (If Possible)

builds.txt

@tj-devel709
Copy link
Contributor

Thanks for your feedback, @SprengerS. Could you provide a build log and a sample project that triggers your error?

@tj-devel709 tj-devel709 added this to the Future milestone Sep 27, 2022
@tj-devel709 tj-devel709 added the need-info Waiting for more information before the bug can be investigated label Sep 27, 2022
@ghost
Copy link

ghost commented Sep 27, 2022

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
Copy link
Author

SprengerS commented Sep 27, 2022

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.

You can find the build log in the builds.txt file. if you need diagnostics build log don't hesitate to ask for. A sample Project needs a lot of time. I will try to create a sample project tomorrow.

@ghost ghost added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Sep 27, 2022
@tj-devel709
Copy link
Contributor

tj-devel709 commented Sep 27, 2022

@SprengerS could you please provide the binlog and the project tree structure (running 'ls -LR')?
https://learn.microsoft.com/en-us/visualstudio/msbuild/obtaining-build-logs-with-msbuild?view=vs-2022

@tj-devel709 tj-devel709 added need-info Waiting for more information before the bug can be investigated and removed need-attention An issue requires our attention/response labels Sep 27, 2022
@ghost
Copy link

ghost commented Sep 27, 2022

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
Copy link
Author

I have resolved this problem with overwriting two current targets. The target _ValidateAppBundle will not be executed for the Watch App and the extensions:

	<!-- Validate App only used for App Extensions Xcode 14. Needs to be checked in future time-->
	<Target Name="_ValidateAppBundle" Condition="'$(IsAppExtension)' == 'false' And '$(IsWatchApp)' == 'true'" DependsOnTargets="_DetectSdkLocations;_ComputeTargetFrameworkMoniker;_GenerateBundleName">
		<ValidateAppBundleTask
			Condition="'$(IsMacEnabled)' == 'true'"
			SessionId="$(BuildSessionId)"
			AppBundlePath="$(_AppBundlePath)"
			SdkIsSimulator="$(_SdkIsSimulator)"
			TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
		/>
	</Target>

My new target _CoreCreateIpa does not copy the _WatchKitStub/WK . But this seems only to be a workaround and not a bugfix:

<!--Create ipa without copying the watchkit stubs which are not necessary any more-->
	<Target Name="_CoreCreateIpa" Condition="'$(BuildIpa)' == 'true'" DependsOnTargets="Codesign">
		<RemoveDir SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Directories="$(DeviceSpecificIntermediateOutputPath)ipa" />

		<MakeDir SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Directories="$(DeviceSpecificIntermediateOutputPath)ipa\Payload" />

		<PropertyGroup>
			<_IpaAppBundleDir>$(DeviceSpecificIntermediateOutputPath)ipa\Payload\$(_AppBundleName).app\</_IpaAppBundleDir>
		</PropertyGroup>

		<!-- Clone the compiled app bundle into the IPA's Payload directory... -->
		<Ditto
			SessionId="$(BuildSessionId)"
			Condition="'$(IsMacEnabled)' == 'true'"
			ToolExe="$(DittoExe)"
			ToolPath="$(DittoPath)"
			Source="$(AppBundleDir)"
			Destination="$(_IpaAppBundleDir)"
		/>

		<FindWatchOS2AppBundle
			SessionId="$(BuildSessionId)"
			Condition="'$(IsMacEnabled)' == 'true' And '@(_ResolvedWatchAppReferences)' != ''"
			WatchAppReferences="@(_ResolvedWatchAppReferences)"
			>
			<Output TaskParameter="WatchOS2AppBundle" PropertyName="_WatchOS2AppBundle"/>
		</FindWatchOS2AppBundle>

		<CollectITunesSourceFiles
			SessionId="$(BuildSessionId)"
			Condition="'$(IsMacEnabled)' == 'true'"
			OutputPath="$(DeviceSpecificOutputPath)"
			>
			<Output TaskParameter="ITunesSourceFiles" ItemName="_ITunesSourceFile"/>
		</CollectITunesSourceFiles>

		<Copy
			SessionId="$(BuildSessionId)"
			Condition="'$(IsMacEnabled)' == 'true' And '@(_ITunesSourceFile)' != ''"
			SourceFiles="@(_ITunesSourceFile)"
			DestinationFolder="$(DeviceSpecificIntermediateOutputPath)ipa"
		/>

		<ItemGroup>
			<_IpaPackageSource Include="$(DeviceSpecificIntermediateOutputPath)ipa\Payload" />
			<_IpaPackageSource Include="$(DeviceSpecificIntermediateOutputPath)ipa\WatchKitSupport" Condition="Exists ('$(DeviceSpecificIntermediateOutputPath)ipa\WatchKitSupport\WK')" />
			<_IpaPackageSource Include="$(DeviceSpecificIntermediateOutputPath)ipa\WatchKitSupport2" Condition="Exists ('$(DeviceSpecificIntermediateOutputPath)ipa\WatchKitSupport2\WK')" />
			<_IpaPackageSource Include="$(DeviceSpecificIntermediateOutputPath)ipa\iTunesMetadata.plist" Condition="'$(IpaIncludeArtwork)' == 'true' And Exists ('$(DeviceSpecificIntermediateOutputPath)ipa\iTunesMetadata.plist')" />
			<_IpaPackageSource Include="$(DeviceSpecificIntermediateOutputPath)ipa\iTunesArtwork@2x" Condition="'$(IpaIncludeArtwork)' == 'true' And Exists ('$(DeviceSpecificIntermediateOutputPath)ipa\iTunesArtwork@2x')" />
			<_IpaPackageSource Include="$(DeviceSpecificIntermediateOutputPath)ipa\iTunesArtwork" Condition="'$(IpaIncludeArtwork)' == 'true' And Exists ('$(DeviceSpecificIntermediateOutputPath)ipa\iTunesArtwork')" />
		</ItemGroup>

		<PropertyGroup>
			<!-- Calculate IpaPackageDir and IpaPackageName based on IpaPackagePath, if defined. -->
			<IpaPackageDir Condition="'$(IpaPackagePath)' != ''">$([System.IO.Path]::GetDirectoryName('$(IpaPackagePath)'))</IpaPackageDir>
			<IpaPackageName Condition="'$(IpaPackagePath)' != ''">$([System.IO.Path]::GetFileName('$(IpaPackagePath)'))</IpaPackageName>

			<!-- Calculate an IPA package directory path if not already defined by the developer. -->
			<!--<IpaPackageDir Condition="'$(IpaPackageDir)' == ''">$([System.Environment]::GetEnvironmentVariable('IPA_PACKAGE_DIR'))</IpaPackageDir>-->
			<IpaPackageDir Condition="'$(IpaPackageDir)' == ''">$(DeviceSpecificOutputPath)</IpaPackageDir>

			<!-- Calculate an IPA package name if not already defined by the developer. -->
			<!--<IpaPackageName Condition="'$(IpaPackageName)' == ''">$([System.Environment]::GetEnvironmentVariable('IPA_PACKAGE_NAME'))</IpaPackageName>-->
			<IpaPackageName Condition="'$(IpaPackageName)' != '' And !$(IpaPackageName.EndsWith ('.ipa', StringComparison.OrdinalIgnoreCase))">$(IpaPackageName).ipa</IpaPackageName>
			<IpaPackageName Condition="'$(IpaPackageName)' == ''">$(_AppBundleName).ipa</IpaPackageName>

			<!-- Calculate the full path of the IPA package if not already defined by the developer. -->
			<!--<IpaPackagePath Condition="'$(IpaPackagePath)' == ''">$([System.Environment]::GetEnvironmentVariable('IPA_PACKAGE_PATH'))</IpaPackagePath>-->
			<IpaPackagePath Condition="'$(IpaPackagePath)' == ''">$(IpaPackageDir)\$(IpaPackageName)</IpaPackagePath>
		</PropertyGroup>
	</Target>

@ghost ghost added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Sep 29, 2022
vouksh pushed a commit to vouksh/xamarin-macios that referenced this issue Nov 9, 2022
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Nov 16, 2022
mandel-macaque pushed a commit that referenced this issue Nov 16, 2022
…chOS project. Fixes #16142. (#16690)

I've made some small edits to the ValidateWatchApp method to allow for a
native watchOS app that was created in Xcode 14 that uses a single
project instead of an extension to be bundled into a Xamarin app.

Should fix #16142 and progress on #10070

Co-authored-by: Jack Butler <jbutler@glneurotech.com>
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Alex Soto <alex@alexsoto.me>
rolfbjarne pushed a commit that referenced this issue Nov 17, 2022
…hOS project. Fixes #16142. (#16773)

I've made some small edits to the ValidateWatchApp method to allow for a native watchOS app that was created in Xcode 14 that uses a single project instead of an extension to be bundled into a Xamarin app. 

Should fix #16142 and progress on #10070

Backport of #16690

Co-authored-by: Jack Butler <jbutler@glneurotech.com>
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Dec 14, 2022
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Dec 14, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2022
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Feb 27, 2023
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Feb 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need-attention An issue requires our attention/response
Projects
None yet
2 participants