Error adding Xamarin.Facebook.iOS nugget package to MAUI project
When I try to install the Xamarin.Facebook.iOS nugget package I'm getting the following error:
Error Could not find a part of the path 'C:\Users[my username].nuget\packages\xamarin.facebook.sharekit.ios\12.2.0.1\lib\xamarinios10\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64-apple-ios-macabi.swiftinterface'.
The Package Manager output contains the following information:
Restoring packages for C:[project path][project name].csproj...
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.ios/index.json
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.ios/index.json 228ms
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.ios/12.2.0.1/xamarin.facebook.ios.12.2.0.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.ios/12.2.0.1/xamarin.facebook.ios.12.2.0.1.nupkg 5ms
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.corekit.ios/index.json
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.gamingserviceskit.ios/index.json
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.loginkit.ios/index.json
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.sharekit.ios/index.json
GET https://api.nuget.org/v3-flatcontainer/system.runtime.interopservices.nfloat.internal/index.json
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.loginkit.ios/index.json 141ms
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.sharekit.ios/index.json 141ms
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.loginkit.ios/12.2.0.1/xamarin.facebook.loginkit.ios.12.2.0.1.nupkg
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.sharekit.ios/12.2.0.1/xamarin.facebook.sharekit.ios.12.2.0.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/system.runtime.interopservices.nfloat.internal/index.json 143ms
GET https://api.nuget.org/v3-flatcontainer/system.runtime.interopservices.nfloat.internal/6.0.1/system.runtime.interopservices.nfloat.internal.6.0.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.sharekit.ios/12.2.0.1/xamarin.facebook.sharekit.ios.12.2.0.1.nupkg 6ms
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.loginkit.ios/12.2.0.1/xamarin.facebook.loginkit.ios.12.2.0.1.nupkg 8ms
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.corekit.ios/index.json 226ms
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.corekit.ios/12.2.0.1/xamarin.facebook.corekit.ios.12.2.0.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.gamingserviceskit.ios/index.json 231ms
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.corekit.ios/12.2.0.1/xamarin.facebook.corekit.ios.12.2.0.1.nupkg 5ms
GET https://api.nuget.org/v3-flatcontainer/xamarin.facebook.gamingserviceskit.ios/12.2.0.1/xamarin.facebook.gamingserviceskit.ios.12.2.0.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/xamarin.facebook.gamingserviceskit.ios/12.2.0.1/xamarin.facebook.gamingserviceskit.ios.12.2.0.1.nupkg 10ms
OK https://api.nuget.org/v3-flatcontainer/system.runtime.interopservices.nfloat.internal/6.0.1/system.runtime.interopservices.nfloat.internal.6.0.1.nupkg 171ms
Installed Xamarin.Facebook.iOS 12.2.0.1 from https://api.nuget.org/v3/index.json with content hash HU34V5RZWsSfValoPaEytZdvsNLRzGe9R8uS0iKN0Hl8sWOC7di1c4WDlBo6U9LtCtRVx9AeI8nTYqEE+y/3ZA==.
Installed System.Runtime.InteropServices.NFloat.Internal 6.0.1 from https://api.nuget.org/v3/index.json with content hash vq+81ZqZz9oHV6iWgGXFnxHAyO5xA73nfvDNu5LwymIK294is5bRo3P063VToAbDRyyc0qq/YFRYjHmiD6Cv8Q==.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users[my user].nuget\packages\xamarin.facebook.sharekit.ios\12.2.0.1\lib\xamarinios10\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64-apple-ios-macabi.swiftinterface'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.File.Create(String path)
at NuGet.Packaging.StreamExtensions.Testable.MmapCopy(Stream inputStream, String fileFullPath, Int64 size)
at NuGet.Packaging.StreamExtensions.Testable.CopyToFile(Stream inputStream, String fileFullPath)
at NuGet.Packaging.PackageFileExtractor.ExtractPackageFile(String source, String target, Stream stream)
at NuGet.Packaging.PackageArchiveReader.CopyFiles(String destination, IEnumerable1 packageFiles, ExtractPackageFileDelegate extractFile, ILogger logger, CancellationToken token) at NuGet.Packaging.PackageReaderBase.CopyFilesAsync(String destination, IEnumerable1 packageFiles, ExtractPackageFileDelegate extractFile, ILogger logger, CancellationToken cancellationToken)
at NuGet.Packaging.PackageExtractor.<>c__DisplayClass5_0.<<InstallFromSourceAsync>b__0>d.MoveNext()
--- 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 NuGet.Common.ConcurrencyUtilities.<ExecuteWithFileLockedAsync>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at NuGet.Common.ConcurrencyUtilities.<ExecuteWithFileLockedAsync>d__51.MoveNext()
--- 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 NuGet.Packaging.PackageExtractor.<InstallFromSourceAsync>d__5.MoveNext()
--- 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 NuGet.Commands.ProjectRestoreCommand.<InstallPackageAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NuGet.Commands.ProjectRestoreCommand.<>c__DisplayClass15_1.<<InstallPackagesAsync>b__4>d.MoveNext()
--- 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 NuGet.Commands.ProjectRestoreCommand.<InstallPackagesAsync>d__15.MoveNext() --- 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 NuGet.Commands.ProjectRestoreCommand.<TryRestoreAsync>d__9.MoveNext() --- 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 NuGet.Commands.RestoreCommand.<ExecuteRestoreAsync>d__85.MoveNext() --- 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 NuGet.Commands.RestoreCommand.<ExecuteAsync>d__67.MoveNext() --- 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 NuGet.Commands.RestoreRunner.<ExecuteAsync>d__7.MoveNext() --- 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 NuGet.Commands.RestoreRunner.<CompleteTaskAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at NuGet.Commands.RestoreRunner.<RunWithoutCommit>d__3.MoveNext() --- 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 NuGet.PackageManagement.DependencyGraphRestoreUtility.<PreviewRestoreProjectsAsync>d__5.MoveNext() --- 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 NuGet.PackageManagement.NuGetPackageManager.<PreviewBuildIntegratedProjectsActionsAsync>d__89.MoveNext() --- 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 NuGet.PackageManagement.NuGetPackageManager.<PreviewProjectsInstallPackageAsync>d__75.MoveNext() --- 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 NuGet.PackageManagement.VisualStudio.NuGetProjectManagerService.<>c__DisplayClass22_0.<<GetInstallActionsAsync>b__0>d.MoveNext() --- 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 NuGet.PackageManagement.VisualStudio.NuGetProjectManagerService.<CatchAndRethrowExceptionAsync>d__331.MoveNext()
Time Elapsed: 00:00:05.5463153
========== Finished ==========
I'm using Visual Studio 2022 Enterprise 17.7.2
My MAUI project have the following properties:
<Project Sdk="Microsoft.NET.Sdk"> ... <TargetFrameworks>net7.0-ios;net7.0-android33.0</TargetFrameworks> ... <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">10.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion> ...
I have successfully added the Xamarin.Facebook.Android 11.2.0.1 package to the same project.
Does somebody know a workaround about this?
Workaround:
- restore nuget on mac
- arcihive facebook nuget cache 3, unarcive it on windows into windows cache
seems like problem is on file path length inside nuget files