dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.86k stars 1.68k forks source link

Maui - some nugets do not work as path is too long "Could not find a part of the path" #17828

Open Zack-G-I-T opened 9 months ago

Zack-G-I-T commented 9 months ago

Description

Using the Xamarin.Firebase.iOS.CloudMessaging nuget in .NET Maui. Android works fine, but in iOS we get this error. I believe it is because the file path is too long - however I have set the system settings to enable long paths and still get this exception. I am using Windows 10 if that is relevant.

**An error occurred while trying to deploy the app 'SamplePush.app'. Details: Could not find a part of the path

'C:\Users\username\AppData\Local\MyTempFiles\Xamarin\HotRestart\Signing\SamplePush.app\out\Payload\SamplePush.app\SamplePush.content\Firebase.CloudMessaging.resources\FirebaseMessaging.xcframework\ios-arm64\FirebaseMessaging.framework\Headers\FirebaseMessaging-umbrella.h'.**

I changed my temp file location to be shorter C:\tmp but still get the following:

**An error occurred while trying to deploy the app 'SamplePush.app'. Details: Could not find a part of the path

'C:\Tmp\Xamarin\HotRestart\Signing\SamplePush.app\out\Payload\SamplePush.app\SamplePush.content\Firebase.Core.resources\GoogleUtilitiesComponents.xcframework\ios-arm64_x86_64-simulator\GoogleUtilitiesComponents.framework\Headers\GoogleUtilitiesComponents-umbrella.h'**

Steps to Reproduce

  1. Download Xamarin.Firebase.iOS.CloudMessaging nuget in a new maui app.
  2. Try and debug in ios and see exception.

Link to public reproduction project repository

No response

Version with bug

7.0.92

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

An error occurred while trying to deploy the app 'SamplePush.app'. Details: Could not find a part of the path

'C:\Users\username\AppData\Local\MyTempFiles\Xamarin\HotRestart\Signing\SamplePush.app\out\Payload\SamplePush.app\SamplePush.content\Firebase.CloudMessaging.resources\FirebaseMessaging.xcframework\ios-arm64\FirebaseMessaging.framework\Headers\FirebaseMessaging-umbrella.h'.
jonathanpeppers commented 9 months ago

Does enabling long paths help here at all?

https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later

/cc @emaf @mauroa

mauroa commented 9 months ago

Created AzDO bug since it belongs to the Platform Tools team: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1899665

radderz commented 9 months ago

Note, long file paths doesn't work in windows 11 at all, both the registry setting and group policy option doesn't work with long paths anymore so this long paths issue is a pretty major regression. Not being able to use Firebase for instance for push notifications is crippling our ability to test our apps.

jonathanpeppers commented 9 months ago

Note, long file paths doesn't work in windows 11 at all, both the registry setting and group policy option doesn't work with long paths anymore

We should file a bug with Windows, if that is the case, this is unrelated to MAUI.

As to the error above:

Could not find a part of the path

'C:\Users\username\AppData\Local\MyTempFiles\Xamarin\HotRestart\Signing\SamplePush.app\out\Payload\SamplePush.app\SamplePush.content\Firebase.CloudMessaging.resources\FirebaseMessaging.xcframework\ios-arm64\FirebaseMessaging.framework\Headers\FirebaseMessaging-umbrella.h'.

Do you know what changed? When it worked, was the path just shorter?

radderz commented 9 months ago

I imagine the path was shorter, any filename over 260 will fail in windows 11, when it was possible to get it working in window 10. I am not sure when this started failing but it's pretty painful after updating our devs all with new laptops running windows 11.

I put the note in here incase that was the issue and it looks like this filename is 271 in length so the long file names setting would need to be enabled to work for this to function. The issue comes from the nuget package download/unzip, which fails due to the long file names. Then the copying to the obj folder can have the same effect if that path ends up too long too.

I am unsure if @Zack-G-I-T is using windows 11 but if he is then I'd say that is the problem he is experiencing.

Edit: @Zack-G-I-T is using Windows 10. You should look up enabling long filenames in registry to allow file paths > 260 in length. After doing that you need to delete the package from your nuget cache as it is already there in a bad state and visual studio will not restore it for you.

Zack-G-I-T commented 9 months ago

@radderz Hi, I am on Windows 10 and I tried enabling long file names in regedit and in group policy and i deleted my whole nuget cache but it didnt work. I ended up having to delete the "_CopyLocalBindingResources" tag from my Xamarin.Shared.Sdk.targets" for it to work.

mauroa commented 8 months ago

@radderz @Zack-G-I-T how are you installing the FireBase NuGet package? If it's by adding a PackageReference or using the Package Manager Console, I guess you are getting an error on installation or restore time, aren't you? I'm just trying to understand if that's the first error you are facing or if it's directly when building the MAUI app for iOS. That would help us to determine the best route for the issue. Thanks

radderz commented 8 months ago

@mauroa it is when trying to build, it tries to copy the contents of the nuget to the obj folder for build, but the file doesn't exist as at nuget restore time since the initial zip extraction fails. It basically gives a cannot copy file error and the overall path is way too long.

image

I tried to change the nuget cache folder to have as short a path as possible but it still fails since it copies it to the obj folder of the project which has a longer path.

mauroa commented 8 months ago

@radderz thanks. That's correct, but it also fails when you install the package or restore it without building. The package installation in the cache folder is what it initially fails. The installation gets incomplete because of the path length issue. When I try to install the package, it shows this error:

Install-Package : Could not find a part of the path C:\Users\myuser\nuget\packages\xamarin.firebase.ios.installations\8.10.0.3\lib\xamarinios10\Firebase.Installations.resources\FirebaseInstallations.xcframework\ios-arm64_x86_64-simu lator\FirebaseInstallations.framework\Headers\FIRInstallationsAuthTokenResult.h.

In fact, If I go to that path and try to manually create that missing file, Windows truncates the file name because of the path policy.

I think this issue is indeed out of the scope of MAUI or tooling, as @jonathanpeppers suggested in a comment above.

radderz commented 8 months ago

Yea it isn't a Maui problem, I'd say however that this is a very commonly used package within MAUI so it is going to be a big pain for a lot of devs using MAUI.

radderz commented 8 months ago

@mauroa, Actually, I just tested using CMD prompt, long file paths is working fine with the registry setting. So the issue is actually with the application trying to access the long paths i.e. nuget and VS.

I.e. try this.

  1. enable long file paths
  2. go to a folder in terminal.
  3. mkdir fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
  4. cd fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
  5. repeat till the folder path is very long

You can create a path that exceeds the size limit of windows 260 chars. explorer doesn't support long file paths but the windows file system is working.

So I do think this is a tooling issue in nuget/VS build.

mauroa commented 8 months ago

Correct, cmd allows it. However, if you try to create a folder or a file in Windows with the UI (right click > New > Folder or right click > New > Text Document) in an already very long and exceeded path (created with cmd), you will see that Windows doesn't allow you to do that. So, we agree that the Windows file system allows it, the Windows explorer doesn't as well as VS/NuGet.

radderz commented 8 months ago

Correct, cmd allows it. However, if you try to create a folder or a file in Windows with the UI (right click > New > Folder or right click > New > Text Document) in an already very long and exceeded path (created with cmd), you will see that Windows doesn't allow you to do that. So, we agree that the Windows file system allows it, the Windows explorer doesn't as well as VS/NuGet.

Yes but that's a choice Microsoft made for "compatibility". Windows explorer isn't used as part of nuget restore and build so that's not really relevent. Nuget, unzip/zip and VS should be able to use the longer file paths.

mauroa commented 8 months ago

Yes, I agree with you. What affects us is anything that touches the VS scope, however I was trying to picture the areas affected by this long path issue, independently of VS, just for context purposes.

harima34 commented 8 months ago

Did you find any workaround ? I got the same problem after update my visual studio and .net8

radderz commented 8 months ago

Did you find any workaround ? I got the same problem after update my visual studio and .net8

No there was no workaround, still can't build ios on .net 8 if using firebase push.

robertev-alchemy commented 7 months ago
  1. gpedit.msc, Local Computer Policy -> Computer Configuration -> Administrative Templates -> System -> Filesystem, then enable the Enable Win32 long paths option
  2. Change msbuild.exe.config :
  3. REBOOT

That actually worked to get around the long path build issues for me, temporarily at least, a couple weeks ago.

Now evidently there has been some update ... and that work-around no longer works, long path issue has returned.

Urghh.

Does anybody have Push Notifications working in MAUI - and an example that compiles, and please list the VS version, nugets, OS version, Firebase plugin version, etc. What is the magic working combination and any OS and msbuild settings?

And why in the world would msbuild default to short paths anyways, especially since max_path limit was removed back in RS1.

ghost commented 7 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

radderz commented 7 months ago

This doesn't work for the firebase package as the filenames are far too long, so just shortening the package cache isn't enough.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: SEONG-AHN LEE @.> Sent: Friday, December 8, 2023 9:47:27 PM To: dotnet/maui @.> Cc: Mark Radcliffe @.>; Mention @.> Subject: Re: [dotnet/maui] Maui - some nugets do not work as path is too long "Could not find a part of the path" (Issue #17828)

C: Create a folder "X" on drive root, copy all the files and folders underneath the solution folder, and build and deploy it.

— Reply to this email directly, view it on GitHubhttps://github.com/dotnet/maui/issues/17828#issuecomment-1846782469, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAJD3T6SHUYVHGUKZ3WFDV3YILHZ7AVCNFSM6AAAAAA5SWEMSGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBWG44DENBWHE. You are receiving this because you were mentioned.Message ID: @.***>

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

CAUTION: This correspondence is confidential and intended for the named recipient(s) only. If you are not the named recipient and receive this correspondence in error, you must not copy, distribute or take any action in reliance on it and you should delete it from your system and notify the sender immediately. Unless otherwise stated, any views or opinions expressed are solely those of the author and do not represent those of Blackhawk Tracking Systems Limited.

IeuanWalker commented 7 months ago

https://github.com/xamarin/GoogleApisForiOSComponents/issues/639

IeuanWalker commented 7 months ago

Has anyone got any workaround?

Atm seems impossible to build push notification using FCM

AlleSchonWeg commented 7 months ago

As far as I know, simply enabling the Long Path in Group Policies is not sufficient. It also needs to be activated in the application manifests. However, for .Net apps, it is enabled by default.

For MsBuild.exe and Nuget.exe, Long Path is indeed enabled. However, when running Nuget and MsBuild through Visual Studio (VS), it doesn't work with long path names. As a workaround, one would need to run Nuget and MsBuild not through VS but through the command line interface (CLI).

It seems that Visual Studio (devenv.exe) restricts the use of long paths in its manifest. This leads to errors during the build process, as explained here: https://github.com/NuGet/Home/issues/3324#issuecomment-977960239

GiuseppeGiacalone commented 6 months ago

I have the same problem with Xamarin.Firebase.iOS.Core... it is impossible to continue in these conditions..

coop-tim commented 6 months ago

After struggling with this myself for multiple days and slogging through misleading errors, fiddly/brittle config and red herring warnings, I thought it best to give back a working solution to the community.

This repo contains a fairly minimal working .NET 8 project targeting iOS and Android with Firebase Cloud Messaging, Analytics and the relevant DevOps build pipelines to get them built and pushed into App Center.

https://github.com/coop-tim/maui-sample

Hoping this helps whilst the root issues are worked on.

AdamEssenmacher commented 6 months ago

Do you know what changed? When it worked, was the path just shorter?

@jonathanpeppers what's changed is Apple's shift to XCFrameworks and how iOS.NET packs these libraries in NuGet.

Take, for example, the Xamarin.Firebase.iOS.Core package for v 8.10.0. This package was built for Xamarin only. The lib directory contained one file with the path xamarinios10/Firebase.Core.dll.

Compare that to the version built for .NET6+ (8.10.0.3). The lib folder packs the XCFrameworks directly. If you crack it open, you find file paths like:

net6-ios15.4/Firebase.Core.resources/GoogleUtilitiesComponents.xcframework/ios-arm64_x86_64-simulator/GoogleUtilitiesComponents.framework/Headers/GoogleUtilitiesComponents-umbrella.h

The verbosity of these long file paths is just part of the nature of how XCFrameworks are designed. Since these resources are no longer packed into a .DLL (like in the Xamarin times), Visual Studio chokes when restoring these packages and when attempting to archive an iOS app for release.

We should file a bug with Windows, if that is the case, this is unrelated to MAUI.

You're right. But let's set Windows 11 aside for a moment. On Windows 10, Visual Studio is still incapable of restoring these NuGet packages or archiving for deployment. So there is a problem with the standard MAUI toolchain (at least on Windows....) So, even if Windows 11 gets around to supporting long filepath support like Windows 10 did, it's very likely that Visual Studio will continue to be incompatible.

One final note. Regardless of 'which team' at Microsoft should bear responsibility for fixing this--it affects MAUI devs just the same. Expectations should be communicated and documentation should be updated to reflect the reality of the situation. If that means Microsoft's flagship IDE is no longer fundamentally capable of building or shipping MAUI apps on the iOS platform, then this should be stated plainly so tech leaders can plan accordingly.

czmirek commented 5 months ago

I have the same problem with Xamarin.Facebook.iOS

Same as above, I have configured long paths, removed bin/obj/.nuget, nothing works.

14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.sharekit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64.swiftinterface" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64.swiftinterface". Beginning retry 1 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64.swiftinterface'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.loginkit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\x86_64.swiftinterface" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\x86_64.swiftinterface". Beginning retry 2 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\x86_64.swiftinterface'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.loginkit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\arm64.swiftinterface" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\arm64.swiftinterface". Beginning retry 2 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\arm64.swiftinterface'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.corekit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\tvos-arm64_x86_64-simulator\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-tvos-simulator.swiftdoc" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\tvos-arm64_x86_64-simulator\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-tvos-simulator.swiftdoc". Beginning retry 2 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\tvos-arm64_x86_64-simulator\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-tvos-simulator.swiftdoc'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.corekit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-ios-macabi.swiftdoc" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-ios-macabi.swiftdoc". Beginning retry 2 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-ios-macabi.swiftdoc'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.corekit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\x86_64-apple-ios-macabi.swiftdoc" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\x86_64-apple-ios-macabi.swiftdoc". Beginning retry 2 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\x86_64-apple-ios-macabi.swiftdoc'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.sharekit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64.swiftinterface" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64.swiftinterface". Beginning retry 2 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64.swiftinterface'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.loginkit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\arm64.swiftinterface" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\arm64.swiftinterface". Beginning retry 3 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\arm64.swiftinterface'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.corekit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\x86_64-apple-ios-macabi.swiftdoc" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\x86_64-apple-ios-macabi.swiftdoc". Beginning retry 3 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\x86_64-apple-ios-macabi.swiftdoc'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.loginkit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\x86_64.swiftinterface" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\x86_64.swiftinterface". Beginning retry 3 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.LoginKit.resources\FBSDKLoginKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKLoginKit.framework\Modules\FBSDKLoginKit.swiftmodule\x86_64.swiftinterface'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.corekit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-ios-macabi.swiftdoc" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-ios-macabi.swiftdoc". Beginning retry 3 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\ios-arm64_x86_64-maccatalyst\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-ios-macabi.swiftdoc'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.corekit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\tvos-arm64_x86_64-simulator\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-tvos-simulator.swiftdoc" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\tvos-arm64_x86_64-simulator\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-tvos-simulator.swiftdoc". Beginning retry 3 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.CoreKit.resources\FBSDKCoreKit.xcframework\tvos-arm64_x86_64-simulator\FBSDKCoreKit.framework\Modules\FBSDKCoreKit.swiftmodule\arm64-apple-tvos-simulator.swiftdoc'.
14>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4911,5): warning MSB3026: Could not copy "C:\Users\lesar\.nuget\packages\xamarin.facebook.sharekit.ios\12.2.0.1\lib\net6.0-ios15.4\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64.swiftinterface" to "bin\Debug\net8.0-ios\ios-arm64\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64.swiftinterface". Beginning retry 3 in 1000ms. Could not find a part of the path 'bin\Debug\net8.0-ios\ios-arm64\Facebook.ShareKit.resources\FBSDKShareKit.xcframework\ios-arm64_i386_x86_64-simulator\FBSDKShareKit.framework\Modules\FBSDKShareKit.swiftmodule\arm64.swiftinterface'.
czmirek commented 5 months ago

Does anyone know if it's possible to run MAUI for iOS debug on real device from cmd somehow, without Visual Studio?

I'm trying the following command

dotnet build -t:Run -f net8.0-ios -p:RuntimeIdentifier=ios-arm64 -p:_DeviceName=obfuscated

But I'm getting this error It's currently not supported to launch an app from the command line on Windows

AdamEssenmacher commented 5 months ago

@czmirek have you tried DotNet.Meteor? https://github.com/JaneySprings/DotNet.Meteor

Also, Visual Studio might still be able to deploy and debug. It's specifically the package restore (and maybe archive) features that are affected.

Something else... you may need to clear your local NuGet cache if Visual Studio has tried and failed due to these long file paths. Then run dotnet restore on command line, then try building / deploying / debugging from Visual Studio.

maranmaran commented 5 months ago

Heyo, checking in.

Currently searching for solution because I can't open my file in VS 2022 on WIN 11 with REG EDIT key and win32 long paths enabled policy

Pretty frustrating...

khalil2099 commented 5 months ago

wow, its 2024 already and FCM iOS is still a problem with long path. i hope people didnt quit developing for iOS because of this.

is there a way to modify the FCM library (rename class name or what ever) to make the path short ?

AlleSchonWeg commented 5 months ago

There is an open feature request for VS: https://developercommunity.visualstudio.com/t/allow-building-running-and-debugging-a-net-applica/351628 since 2018. But no progress. Somewhere i read that the Visual Studi 32 Bit Version support long path. But i can't find it anymore.

czmirek commented 5 months ago

@czmirek have you tried DotNet.Meteor? https://github.com/JaneySprings/DotNet.Meteor

Also, Visual Studio might still be able to deploy and debug. It's specifically the package restore (and maybe archive) features that are affected.

Something else... you may need to clear your local NuGet cache if Visual Studio has tried and failed due to these long file paths. Then run dotnet restore on command line, then try building / deploying / debugging from Visual Studio.

Thank you very much, I did not know about Meteor, I'm surprised I hear about it for the first time.

Also, yeah, the package stuff, the problem is that now I've started developing for iOS, the package error happens every time I build. So I guess writting a prebuild script that always deletes the affected packages might work.

blackforest-tom commented 5 months ago

Using VS 17.8.5 on Windows 11, it didn't work when I changed the setting in gpedit. After trying a lot of things, I thought it might be a good idea to check the registry key as well. And it was set to "0". I changed it to 1, and after restarting VS the build suddenly works!

archergod commented 5 months ago

I seems to have issue not just Firebase but iOS simulator is not working. now I feel it is because of Long path only. VS 17.8.5 and Firebase and iOS on Windows 11 .. seems it is broken and this important thing is on backlog from MS is not good.

AlleSchonWeg commented 5 months ago

There is PR (from a MS guy) trying to workaround this issue: https://github.com/xamarin/GoogleApisForiOSComponents/pull/632 But open since october 2023 with no response/progress.

I have no hope that VS will support long paths in the near future, because the problem is known for 6 years and nothing happens. Everywhere no feedback from microsoft. It's a total desaster. We developers left alone. Very disappointing.

mattleibow commented 5 months ago

@rolfbjarne @dalexsoto is there anything that can be done in the iOS SDK to avoid Windows issues?

IeuanWalker commented 5 months ago

@mattleibow A PR was created a while ago for it - https://github.com/xamarin/GoogleApisForiOSComponents/pull/632

khalil2099 commented 5 months ago

for those who are still having problem building projects with FCM (ios) because of long path, you can manually build it in the console.

Package Manager Console dotnet build --framework net8.0-android dotnet build --framework net8.0-ios

after that, on vs, just debug, it will skip build and will deploy to phone/simulator.

only visual studio have this long path problem, but the console program doesnt have this problem.

Mouso00 commented 5 months ago

Does enabling long paths help here at all?

https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later

/cc @emaf @mauroa

It workef for me i copy , paste in the dev power shell and it enabled the Long Path

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" ` -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

bitbiapp commented 4 months ago

After trying many different solutions, all using Visual Studio 2022, I have found a solution that allows you to compile and sign the .AAB file to upload to the Google Play console.

  1. Select the MAUI project of the solution and in the context menu select the option: Open in Terminal.
  2. Use the keytool commands to create a new store or to import the certificate with which the .AAB package will be signed.

Once the certificate process is finished, use this command:

dotnet publish -f net7.0-android -c Release -p:AndroidKeyStore=true -p:AndroidSigningKeyStore={fileName}.keystore -p:AndroidSigningKeyAlias={key-alias} -p:AndroidSigningKeyPass={keypassword} -p:AndroidSigningStorePass={keystorepassword}

The process takes a few minutes and creates the signed .AAB file in the bin/release folder that can be uploaded to the Google Play Console

If an error occurs in the process, delete the bin and obj folders from the project and run the command: dotnet restore before trying the compilation again.

ts69repo commented 4 months ago

as per bitbiapp

https://learn.microsoft.com/en-us/dotnet/maui/ios/deployment/publish-cli?view=net-maui-8.0

works to create ipa for distribution

czmirek commented 4 months ago

I've observed that if you have multiple startup projects in your Visual Studio including your .NET MAUI project, then the bug is almost guaranteed to happen.

But if you have only the .NET MAUI project selected as the startup project, the bug with long path does not happen at all.

archergod commented 4 months ago

I've observed that if you have multiple startup projects in your Visual Studio including your .NET MAUI project, then the bug is almost guaranteed to happen.

But if you have only the .NET MAUI project selected as the startup project, the bug with long path does not happen at all.

I disagree as my solution have 2 project and one is library project so it cannot be set as Startup project and other is this .NET MAUI app that is set as single startup project, but it still fails for me. But maybe things change as VS has new version now and I Didn't try it on yet.

czmirek commented 4 months ago

I've observed that if you have multiple startup projects in your Visual Studio including your .NET MAUI project, then the bug is almost guaranteed to happen. But if you have only the .NET MAUI project selected as the startup project, the bug with long path does not happen at all.

I disagree as my solution have 2 project and one is library project so it cannot be set as Startup project and other is this .NET MAUI app that is set as single startup project, but it still fails for me. But maybe things change as VS has new version now and I Didn't try it on yet.

You're right, that's not it, I got the errors anyway :(

So now when the errors happen I close VS, ensure no MSBuild is running with taskkill /im msbuild.exe /f /t then open two terminals, one in admin mode and I run the command mentioned in this thread in both of them:

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

Then I open VS again and it usually starts working again....until it does not. I have no idea why, whether the actual registry value resets for some reason (I haven't looked) or VS changes something in its state.

archergod commented 4 months ago

I think best bet is not Visual Studio but to use VSCode .. I read in other places that VS Code or commandline for that matter works for them fine. I have move on to different project so cannot test my problem code until later. But I am counting on command line tools only.

zLordZachy commented 4 months ago

This is terrible, I'm getting tired of it ... enable long paths, will eventually solve problem . But for that you need to delete the bin obj or even put them in the root directory.

ia3n commented 3 months ago

This really is beyond a joke at this point - the last functional Firebase package for iOS was released on 7 Nov 2020. Yes, that's right, it's been almost FOUR YEARS since we had a package available that we could actually, you know... compile.

Up until now we could use the old 2020 releases to get by on Mono, but there has never been a working option for .Net and with Mono depreciated this just went from unfortunate to a real dealbreaker.

The big issue for me is that it breaks Xamarin.Google.iOS.MobileAds meaning that there is no way to currently monetize iOS projects. Working AdMob nugets should be at the top of Microsoft's list if they ever hope for MAUI to be a contender in the cross-platform space.

You know who DOES have working AdMob libraries? Flutter. I don't really want to go through the painful process of learning dart and refactoring all my apps, but at this point I'm not sure which is more painful, 3 months of reworking everything or another four years waiting for Microsoft to raise the character limit enough for us to run their own packages.

AlleSchonWeg commented 3 months ago

I think flutter has first class support for google/firebase apis. Because flutter and android are google tools.

WeirdAnakin commented 2 months ago

Is there any news on this? Any confirmed way of working around yet?

KnollK commented 1 month ago

Here is the workaround I was able to use to install a few of these longer name NuGet packages and get an iOS build running on a simulator, which still crashes immediately for me but that is my Maui Migraine to deal with. Hopefully this helps someone.

  1. Add a Nuget.config file to the root directory of your solution with the following (change the "C:\Nuget" to whatever you want as long as it is short):

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <config>
        <clear />
        <add key="globalPackagesFolder" value="C:\Nuget" />
    </config>
    </configuration>
  2. In Visual Studio 2022 change the workspace path for your project: File > Source Control > Advanced > Workspaces > Edit > Enter a New Working Folder click the ellipses (should be an option under "Source Control Folder" header) > Select the folder of your solution > Click the local folder and change it to an incredibly short path on your machine.