Could not find a part of the path

-- -- 957 Reputation points
2024-02-29T22:41:37.6633333+00:00

Hi Vusual Studio 2022 on Windows. Building for release gives below error. Long paths are enabled in Windows. How can I fix this please? Thanks Regards

MSB3021 Unable to copy file "C:\Nugets\xamarin.firebase.ios.core\8.10.0.3\lib\net6.0-ios15.4\Firebase.Core.resources\GoogleUtilitiesComponents.xcframework\ios-arm64_x86_64-simulator\GoogleUtilitiesComponents.framework\PrivateHeaders\GULCCComponentContainerInternal.h" to "bin\Release\net8.0-ios\ios-arm64\Firebase.Core.resources\GoogleUtilitiesComponents.xcframework\ios-arm64_x86_64-simulator\GoogleUtilitiesComponents.framework\PrivateHeaders\GULCCComponentContainerInternal.h". Could not find a part of the path 'bin\Release\net8.0-ios\ios-arm64\Firebase.Core.resources\GoogleUtilitiesComponents.xcframework\ios-arm64_x86_64-simulator\GoogleUtilitiesComponents.framework\PrivateHeaders\GULCCComponentContainerInternal.h'

Developer technologies | .NET | .NET MAUI
{count} vote

Answer accepted by question author
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,151 Reputation points Microsoft External Staff
    2024-03-01T02:29:16.47+00:00

    Hello,

    Vusual Studio 2022 on Windows.

    For Visual Studio, this long path error is expected because VS cannot support long paths. You could refer to Long Path Support in Visual Studio #2323 for more detailed information.

    For this problem, you can refer to Maui - iOS push notification cannot be set up - Could not find a part of the path (Path too long) #630 and operate it manually through the dotnet command line tool.

    Try clearing your local nuget cache and run a nuget restore from the command line (not using Visual Studio).

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Juan Carlos Marcano 0 Reputation points
    2025-10-26T07:58:58.98+00:00

    Easy Solution: create environment variable

    User variables for...
    NUGET_PACKAGES: C:\nuget_packages

    Close Visual Studio and Open again.

    It will create folder: C:\nuget_packages, with all packages, shorting path.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.