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

ResolveNativeReferences FAILED when building iOS #130

Open
YeldarOralov opened this issue Jul 27, 2022 · 21 comments
Open

ResolveNativeReferences FAILED when building iOS #130

YeldarOralov opened this issue Jul 27, 2022 · 21 comments
Labels
question Further information is requested

Comments

@YeldarOralov
Copy link

YeldarOralov commented Jul 27, 2022

Hello, I am trying to use the scanner on MAUI
I used your sources and copied them in full to our local nuget.
Android build and works succesfully. But on iOS there is an error.

I tried to build your sample for maui, but the same error occurs.

build_log.txt

May I know which versions of iOS SDK you are using?

@YeldarOralov YeldarOralov added the question Further information is requested label Jul 27, 2022
@JimmyPun610
Copy link
Owner

JimmyPun610 commented Aug 12, 2022

Just checking the log and seems the error is

 Tool /usr/bin/unzip execution started with arguments: -u -o -d "obj\\Release\\net6.0-ios\\ios-arm64\\MLKit.Core.resources.zip" "C:\\Nuget\\xamarin.mlkit.ios.core.jimmypun610\\5.0.0.1\\lib\\net6.0-ios15.4\\MLKit.Core.resources.zip"
1>        C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.4.414\tools\msbuild\iOS\Xamarin.Shared.targets(143,3): error MSB4018: The "ResolveNativeReferences" task failed unexpectedly.
1>        C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.4.414\tools\msbuild\iOS\Xamarin.Shared.targets(143,3): error MSB4018: System.AggregateException: One or more errors occurred. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified

Not sure why the file is not downloading to your repo.
I am using Visual Studio for Mac preview 17.4 and iOS 15.6

@DSlutter
Copy link

I also received this error, are there any known work arounds at the moment?

@JimmyPun610
Copy link
Owner

If you are using Windows to connect mac, you may try #124 to see if it can fix the issue.

@DSlutter
Copy link

DSlutter commented Aug 12, 2022

I've already tried that as I had the same issue. I've put my packages in a folder called 'N' at the start of my drive so I can't shorten the directory url any further.

@JimmyPun610
Copy link
Owner

I've already tried that as I had the same issue. I've put my packages in a folder called 'N' at the start of my drive so I can't shorten the directory url any further.

You could try to extract the zip the to folder path mentioned and see if it works or not.
https://drive.google.com/file/d/1j8XQfbKSVcOO2HcY-fLeqhPnsvBy9EXg/view?usp=sharing

@DSlutter
Copy link

That didn't work. Tried it with the nuget package installed as well.

@YeldarOralov
Copy link
Author

@JimmyPun610 I already tried everything you wrote, but nothing helped me.

@clough360
Copy link

@YeldarOralov I am having exactly the same issue - did you resolve it?

@sikandaramla
Copy link

Was anyone able to solve this issue?

@ajz1966
Copy link

ajz1966 commented Nov 11, 2022

I can't add anything other than I have a Xamarin project linked to a Mac and running the barcode scanner perfectly. I have the translated Maui app on the same Windows machine linked to the same Mac and it is failing with the ResolveNativeReferences issue. It compiles, runs and packages fine on Android though. Also, on Visual Studio for Mac on a Mac, it does compile. It shows a black screen on the simulator without running but I think that is unrelated to this.

@sikandaramla
Copy link

I can't add anything other than I have a Xamarin project linked to a Mac and running the barcode scanner perfectly. I have the translated Maui app on the same Windows machine linked to the same Mac and it is failing with the ResolveNativeReferences issue. It compiles, runs and packages fine on Android though. Also, on Visual Studio for Mac on a Mac, it does compile. It shows a black screen on the simulator without running but I think that is unrelated to this.

Microsoft has resolved this issue with the latest version (17.4.0). Get the latest for both Windows and Mac.

@ajz1966
Copy link

ajz1966 commented Nov 14, 2022

I can't add anything other than I have a Xamarin project linked to a Mac and running the barcode scanner perfectly. I have the translated Maui app on the same Windows machine linked to the same Mac and it is failing with the ResolveNativeReferences issue. It compiles, runs and packages fine on Android though. Also, on Visual Studio for Mac on a Mac, it does compile. It shows a black screen on the simulator without running but I think that is unrelated to this.

Microsoft has resolved this issue with the latest version (17.4.0). Get the latest for both Windows and Mac.

It still gets the ResolveNativeReferences error upon compiling while pointed toward an iOS simulator even with 17.4

@ajz1966
Copy link

ajz1966 commented Nov 16, 2022

This issues still occurs with 17.4.0. Reading a diagnostic dump, the offending issues seems to be: 1> Tool /usr/bin/unzip execution started with arguments: -u -o -d "obj\Debug\net7.0-ios\iossimulator-x64\MLKit.Core.resources.zip" "C:\Users\xx\.nuget\packages\xamarin.mlkit.ios.core.jimmypun610\5.0.0.1\lib\net6.0-ios15.4\MLKit.Core.resources.zip"

So, something with missing file MLKit.Core.resources.zip missing from xamarin.mlkit.ios.core.jimmypun610???

@mattjohnsonpint
Copy link

You're likely experiencing this issue - which happens for any nuget package that contains an iOS native resources zip file, but only when using pair-to-mac on a Windows machine.

xamarin/xamarin-macios#16001

@ajz1966
Copy link

ajz1966 commented Dec 13, 2022

It seems to me this should be tagged as a bug rather than a question.

@programatix
Copy link

I'm encountering this issue with VS 17.4.3 too when compiling iOS using a remote mac. The issue only happen for MAUI, not Xamarin.

@ajz1966
Copy link

ajz1966 commented Jan 3, 2023

I'm encountering this issue with VS 17.4.3 too when compiling iOS using a remote mac. The issue only happen for MAUI, not Xamarin.

I think mattjohnsonpint's reply from November 30 sums it up but it's doesn't help me solve anything. I ended up switching to the Zxing.Net.Maui library. However, I'm finding that library is not working for me either. At least it compiles but the hot reloader stops and it is stuck in a loop deploying. That is much better than the JimmyPun610 Maui library which can't compile at all neither in my project or this Github sample project. I have tried to compile from a PC linked to a Mac and using VS for Mac on a Mac which doesn't work though I admit Apple is an unknown and alien environment for me. It's a shame as the Xamarin version was absolutely perfect. We have stopped development on our device app. Xamarin isn't keeping up and Maui is not ready to handle a robust app that can use a device's camera to take pictures, read bar codes, etc. I should qualify that and say, Maui is pretty good at doing many things across multiple Android devices (our app works perfectly on Android) but not iOS. I can't fault Jimmy Pun but I sure do fault the Maui team for giving developers a tool that is supposed to be a develop in one place, deploy across multiple platform tool yet we have to dance around with a jury rigged setup of a prelease of Visual Studio, multiple XCode versions, SDK's versions, .net versions, etc and, if they do not work in concert with each other, a project that compiled and deployed yesterday may not do so today.

@JimmyPun610
Copy link
Owner

Sorry for the late reply, just an update that below thread may help with this issue.
#100 (comment)

Unfortunately I do not have a Windows + Mac to test it with Pair to Mac.

@hoangtutravinh
Copy link

Hello,
Thread 100 (comment) not working for me

<Target Name="_CollectHotRestartFrameworksFromPackages" BeforeTargets="_CollectHotRestartFrameworks" Condition="'$(IsHotRestartBuild)' == 'true'"> <ItemGroup> <_PackageResourcesDirs Include="@(AssembliesWithFrameworks -> '%(RootDir)%(Directory)%(FileName).resources')" Condition="Exists('%(RootDir)%(Directory)%(FileName).resources')" /> <_PackageResourcesZips Include="@(AssembliesWithFrameworks -> '%(RootDir)%(Directory)%(FileName).resources.zip')" Condition="Exists('%(RootDir)%(Directory)%(FileName).resources.zip')" /> </ItemGroup> <PropertyGroup> <HotRestartPackageResourcesDir>$(TEMP)\Xamarin\HotRestart\Resources\</HotRestartPackageResourcesDir> </PropertyGroup> <Unzip ZipFilePath="@(_PackageResourcesZips)" ExtractionPath="$(HotRestartPackageResourcesDir)%(NuGetPackageId)\%(NuGetPackageVersion)" Condition="'@(_PackageResourcesZips)' != '' And !Exists('$(HotRestartPackageResourcesDir)%(NuGetPackageId)\%(NuGetPackageVersion)')" /> <ItemGroup Condition="'@(_PackageResourcesZips)' != ''"> <_PackageResourcesDirs Include="@(_PackageResourcesZips -> '$(HotRestartPackageResourcesDir)%(NuGetPackageId)\%(NuGetPackageVersion)')" /> </ItemGroup> <ItemGroup Condition="'@(_PackageResourcesDirs)' != ''"> <_PackageResourcesFrameworkFiles Include="%(_PackageResourcesDirs.Identity)\*.framework\*" /> <_PackageResourcesFrameworkFiles Include="%(_PackageResourcesDirs.Identity)\**\*.xcframework\ios-arm64\*.framework\*" /> <_HotRestartFrameworksFromPackages Include="@(_PackageResourcesFrameworkFiles -> '%(RootDir)%(Directory)')" KeepDuplicates="false" /> <_HotRestartFrameworks Include="@(_HotRestartFrameworksFromPackages -> TrimEnd('\'))" /> </ItemGroup> </Target>

When debug (pair to Mac) get error

error MSB4018: The "ResolveNativeReferences" task failed unexpectedly. error MSB4018: System.AggregateException: One or more errors occurred. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified error MSB4018: at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) error MSB4018: at Xamarin.Utils.Execution.<>c__DisplayClass24_1.<RunAsync>b__0() in /Users/builder/azdo/_work/1/s/xamarin-macios/tools/common/Execution.cs:line 103

@JimmyPun610 JimmyPun610 mentioned this issue Apr 14, 2023
@lpierpoint
Copy link

hi, is there any workaround for this? i have tried all the solutions above and still no luck...

@geertgeerits
Copy link

geertgeerits commented Aug 29, 2023

I got also that error, is there a solution for this problem?
Visual Studio Community 2022 -Version 17.7.2

Severity Code Description Project File Line Suppression State
Error MSB4018 The "ResolveNativeReferences" task failed unexpectedly.
System.AggregateException: One or more errors occurred. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Xamarin.Utils.Execution.<>c__DisplayClass24_1.b__0() in /Users/builder/azdo/_work/1/s/xamarin-macios/tools/common/Execution.cs:line 103
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Xamarin.MacDev.Tasks.XamarinTask.<ExecuteAsync>d__24.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs:line 120 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at Xamarin.MacDev.Tasks.ResolveNativeReferencesBase.ProcessSidecar(ITaskItem r, String resources, List1 native_frameworks) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferencesBase.cs:line 133
at Xamarin.MacDev.Tasks.ResolveNativeReferencesBase.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferencesBase.cs:line 104
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
---> (Inner Exception #0) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Xamarin.Utils.Execution.<>c__DisplayClass24_1.b__0() in /Users/builder/azdo/_work/1/s/xamarin-macios/tools/common/Execution.cs:line 103
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Xamarin.MacDev.Tasks.XamarinTask.d__24.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs:line 120<---
BarcodeGenerator C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7089\tools\msbuild\iOS\Xamarin.Shared.targets 137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests