maui: MAUI Blazor app with long reference paths fails to Deploy on Windows

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.

Relevant log output

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 4
  • Comments: 21 (2 by maintainers)

Most upvoted comments

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

@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.

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

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!