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

MAUI Blazor app with long reference paths fails to Deploy on Windows #10068

Closed
TimPurdum opened this issue Sep 12, 2022 · 22 comments
Closed

MAUI Blazor app with long reference paths fails to Deploy on Windows #10068

TimPurdum opened this issue Sep 12, 2022 · 22 comments
Labels
discussed Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done. has-workaround platform/windows 🪟 Priority: 2 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@TimPurdum
Copy link

TimPurdum commented Sep 12, 2022

Description

I'm using this public repo from our company. If I clone the repository into a relatively short path such as C:\git, it all works as expected. However, if I clone into a longer path, such as in C:\Users\TimPurdum\OneDrive - Dymaptic\git, all the applications work except the MAUI sample app, which throws the following exception:

DEP1000: Cannot copy file "C:\Users\TimPurdum\OneDrive - Dymaptic\Documents\dy-blazor-api-core\samples\dymaptic.Blazor.GIS.API.Core.Sample.Shared\obj\Debug\net6.0\scopedcss\projectbundle\dymaptic.Blazor.GIS.API.Core.Sample.Shared.bundle.scp.css" to layout "C:\Users\TimPurdum\OneDrive - Dymaptic\Documents\dy-blazor-api-core\samples\dymaptic.Blazor.GIS.API.Core.Sample.Maui\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\wwwroot\_content\dymaptic.Blazor.GIS.API.Core.Sample.Shared\dymaptic.Blazor.GIS.API.Core.Sample.Shared.bundle.scp.css". DirectoryNotFoundException - Could not find a part of the path 'C:\Users\TimPurdum\OneDrive - Dymaptic\Documents\dy-blazor-api-core\samples\dymaptic.Blazor.GIS.API.Core.Sample.Maui\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\wwwroot\_content\dymaptic.Blazor.GIS.API.Core.Sample.Shared\dymaptic.Blazor.GIS.API.Core.Sample.Shared.bundle.scp.css'. [0x80070003]	dymaptic.Blazor.GIS.API.Core.Sample.Maui			

Steps to Reproduce

  1. Clone https://github.com/dymaptic/dy-blazor-api-core into a long file path, such as inside your OneDrive directory.
  2. Open the src/dymaptic.Blazor.GIS.API.Core.sln in Visual Studio 2022 (I'm using the latest Preview).
  3. Select and run the .MAUI sample application, targeting Windows Machine.

Expected Outcome:
Application starts and runs on Windows machine.

Actual Outcome:
Error listed in description.

Link to public reproduction project repository

https://github.com/dymaptic/dy-blazor-api-core

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Target Framework: net6.0-windows10.0.19041.0

Did you find any workaround?

Moving to a shorter file path works as a temporary workaround.
#10068 (comment)

Relevant log output

No response

@TimPurdum TimPurdum added the t/bug Something isn't working label Sep 12, 2022
@Eilon Eilon added the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Sep 12, 2022
@mkArtakMSFT mkArtakMSFT added this to the .NET 8 Planning milestone Sep 12, 2022
@marcmognol
Copy link
Contributor

Hi,
I am not sure that your issue is due to MAUI. On Windows you have a limitation for path length:

https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

Could you check that your path length is not greater than 260?

@TimPurdum
Copy link
Author

Hi, I am not sure that your issue is due to MAUI. On Windows you have a limitation for path length:

https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

Could you check that your path length is not greater than 260?

Marc,

Thanks for your comment. I believe you are correct, my file paths listed above are just over the 260 limit. I was surprised because I was sure this limit had been raised/removed in recent versions of Windows.

I wonder if this still needs attention by someone at MS though, especially since ~85 characters (about a third) of the file path (\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\wwwroot\_content\ and .bundle.scp.css) are non-negotiably created by .NET on deployment, and namespaces are repeated 3 times in the path (root folder, _content folder, and in the bundle name)?

In the meantime, I will add your link to the documentation for our repository and package. Thanks again!

@TimPurdum
Copy link
Author

Follow-up. I followed the directions on @marcmognol 's link to "Enable Long Paths", did a reboot, checked the registry key, and added to the MAUI windows app.manifest, yet I still get the same error. I don't know if that means the windows 260 limit is not the issue, or if Visual Studio just still fails on 260?

@loligans
Copy link

loligans commented Oct 5, 2022

I also am running into this same issue. I am running Visual Studio 2022 and deploying a Maui Blazor app. Even enabling long file paths + a reboot, doesn't work for me.

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

@mkArtakMSFT mkArtakMSFT added the discussed Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done. label Nov 2, 2022
@mkArtakMSFT mkArtakMSFT added Priority: 2 discussed Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done. and removed discussed Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done. labels Nov 16, 2022
@jfversluis
Copy link
Member

I see this issue is planned for .NET 8, but I came across this and noticed a few things so let me add that. Maybe it will help diagnose/fix this when we get to it.

@loligans could you add the file path that you have been using? Because I notice that the path from @TimPurdum has spaces in it. While that is valid on Windows, I wonder if we do not escape that somewhere. Could you both confirm that the path has spaces in it and that it behaves correctly (or at least differently) when the path does not have spaces?

Additionally it seems that the long paths do not seem to be the root cause then since you both mention that you have enabled that.

It's a long shot, but are you by any chance on .NET 7 by now? Can you confirm that this still occurs on the latest versions of things?

@bradencohen
Copy link
Contributor

@jfversluis I can confirm that this still occurs on .NET 7.

@DaveNatalieTripArc
Copy link

This is still an issue in .Net 8 RC1. I can't deploy to a local iOS device because of a path being over 260 characters.

In the logs, I can see this error:

An error occurred while trying to create the .ipa file for CompanyName.TheMobileAppWithAReallyLongName. 
Details: Could not find a part of the path 'C:\Users\username\AppData\Local\Temp\Xamarin\HotRestart\Signing\CompanyName.TheMobileAppWithAReallyLongName.app\out\Payload\CompanyName.TheMobileAppWithAReallyLongName.app\CompanyName.TheMobileAppWithAReallyLongName.content\Microsoft.Extensions.Configuration.Abstractions.dll'.

This path exists, but the path length is 275 characters. I have already enabled long paths in Windows.

Is there any workaround that doesn't require me to rename my app?

@homeyf
Copy link

homeyf commented Sep 25, 2023

Verified this issue with Visual Studio Enterprise 17.8.0 Preview 2.0. Can repro on windows platform with sample project.
https://github.com/dymaptic/dy-blazor-api-core

@homeyf homeyf added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Sep 25, 2023
@samhouts samhouts modified the milestones: .NET 8 Planning, Under Consideration Sep 27, 2023
@datvm
Copy link

datvm commented Oct 5, 2023

Is there a workaround in the meantime? I am hitting this and as other said, enabling Long path doesn't work. I don't really know how to shorten the name any further because the file of the library is that way:

"C:\Users\lukev\.nuget\packages\blazormaterialweb.bundled\1.0.1\staticwebassets\roboto\fonts\roboto-v30-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-100.woff2"

@TimPurdum
Copy link
Author

@datvm the only workaround I have found during development is to move my project into C:\git\projectFolder or event C:\projectFolder. However, if your example, it looks like you would have to move your .nuget folder, which I've never tried to do.

@datvm
Copy link

datvm commented Oct 9, 2023

@TimPurdum It's actually not a problem with the nuget folder but with my project "Deploy" destination (interestingly it builds successfully, just fails when deploying). Unfortunately it's part of a larger Git repo and even with I moved it to D:\ it's still too long. I had to copy that single project out for now whenever I want to test it. Thanks for the info though.

@GODston
Copy link

GODston commented Nov 2, 2023

Im having a similar issue, if not the same.
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4879,5): error MSB3021: Unable to copy file "C:\Users\Axis\.nuget\packages\xamarin.firebase.ios.cloudfirestore\8.10.0.3\lib\net6.0-ios15.4\Firebase.CloudFirestore.resources\absl.xcframework\ios-arm64_x86_64-simulator\absl.framework\Headers\time\internal\cctz\include\cctz\time_zone.h" to "bin\Release\net7.0-ios\iossimulator-x64\Firebase.CloudFirestore.resources\absl.xcframework\ios-arm64_x86_64-simulator\absl.framework\Headers\time\internal\cctz\include\cctz\time_zone.h". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

The second path is only over 260 characters, and that is considering the full path, not the partial one showed on the message.
The weird thing is i dont even have Windows as an enabled target.

@GODston
Copy link

GODston commented Nov 2, 2023

Im also facing the issue:

1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4879,5): error MSB3030: Could not copy the file "C:\Users\Axis\.nuget\packages\xamarin.firebase.ios.cloudfirestore\8.10.0.3\lib\net6.0-ios15.4\Firebase.CloudFirestore.resources\grpcpp.xcframework\ios-arm64_x86_64-simulator\grpcpp.framework\PrivateHeaders\src\core\tsi\alts\zero_copy_frame_protector\alts_iovec_record_protocol.h" because it was not found.

The file mentioned exists in its location, but i guess it fails because the path is around 270 characters long.
Thats troublesome because the path before .nuget is fairly short, so not much to do there, and its still not even targetting Windows.

@datvm
Copy link

datvm commented Nov 14, 2023

So I try to use Junction as a workaround to shorten the path:

New-Item New-Item -ItemType Junction -Path "D:\MyLongProjectPath" -Target "D:\Temp\Proj"

VS builds successfully but unfortunately now trying to deploy results in another error:

DEP0700: Registration of the app failed. [0x80073CF0] error 0x800701C0: Opening file from location: AppxManifest.xml failed with error: The path cannot be traversed because it contains an untrusted mount point.

Is there any workaround for this instead?

@harima34
Copy link

Any workaround ? i got the same problem

@RHV044
Copy link

RHV044 commented Nov 23, 2023

This is still an Issue on .NET 8

@lisa3907
Copy link

<PropertyGroup>
	<BaseOutputPath>C:\temp</BaseOutputPath>
</PropertyGroup>

@datvm
Copy link

datvm commented Nov 26, 2023

@lisa3907 I can't believe I didn't think about that workaround! Thank you.

@ymebrugts
Copy link

Just had this issue as well on .NET8. I am contributing to a few projects so I have them cloned as submodules in my MAUI app repo. On top of that one of these submodules makes use of AAPT which references files like
common_google_signin_btn_text_light_normal_background.9.png

Once you start using this workflow the limit is just around the corner. It would be nice to have long path support.

@harima34
Copy link

<PropertyGroup>
	<BaseOutputPath>C:\temp</BaseOutputPath>
</PropertyGroup>

You add this into the mobile.csproj ? If yes you add it somewhere specially or ? Because if i add it there, i got a error

MSB4184 cannot evaluate the expression "[MSBuild]::MakeRelative(C:\temp\Debug\net8.0-ios\ios-arm64\publish,
F:\myapp\myapp.Mobile/C:\temp\Debug\net8.0-ios\ios-arm64\device-builds\iphone10.6-16.7.2\myapp.Mobile.app)".
The given path format is not supported. myapp.Mobile C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets 1037

(F: is the ssd where the app project is stored)

@lisa3907
Copy link

lisa3907 commented Dec 1, 2023

<PropertyGroup>
	<BaseOutputPath>C:\temp</BaseOutputPath>
</PropertyGroup>

You add this into the mobile.csproj ? If yes you add it somewhere specially or ? Because if i add it there, i got a error

MSB4184 cannot evaluate the expression "[MSBuild]::MakeRelative(C:\temp\Debug\net8.0-ios\ios-arm64\publish, F:\myapp\myapp.Mobile/C:\temp\Debug\net8.0-ios\ios-arm64\device-builds\iphone10.6-16.7.2\myapp.Mobile.app)". The given path format is not supported. myapp.Mobile C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets 1037

(F: is the ssd where the app project is stored)

It must be in the same location. C: If you have a project, you can do it with ₩temp

@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Dec 7, 2023
@Eilon Eilon removed this from the Under Consideration milestone Dec 15, 2023
@samhouts samhouts added has-workaround and removed p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint labels Apr 4, 2024
@mkArtakMSFT mkArtakMSFT removed the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Apr 5, 2024
@PureWeen
Copy link
Member

Unfortunately, this is an OS limitation and not something that .NET MAUI can address.

Since a number of workarounds have been provided, I'm going to close this issue.

@github-actions github-actions bot locked and limited conversation to collaborators May 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussed Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done. has-workaround platform/windows 🪟 Priority: 2 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests