2

I'm trying to publish an ASP.NET Core web application with Angular frontend to my webhosting account. The project uses SSR, which causes generated files to end up at a path longer than 260 characters.

Usually I put the solution folder directly within my C:\ drive in order to prevent paths from becoming longer than 260 characters, and this works fine.

Yesterday I acquired Windows 10 Pro and did the following things:

  • gpedit.msc → Computer configuration → Administrative Templates → System → File System → Enable Win32 long paths = Enabled
  • Regedit → Locate HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled was already set to 1
  • Reboot my computer

Now I'm trying to publish my ASP.NET Core with Angular application with Visual Studio (Administrator) through Web Deploy, but I'm still getting the PathTooLongException

Unable to copy file

Why is this still happening?

Edit:

I tried adding a manifest file to my project as stated here, but it's still not working: (longpaths.manifest inside my project)

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:compatibility.v1">
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
    </windowsSettings>
  </application>
</assembly>
Pieterjan
  • 2,738
  • 4
  • 28
  • 55
  • 1
    Just an unqualified idea, but can you configure SSR to be less verbose? Sufficient path characters to identify more than every elementary particle in the known universe might be excessive. – Andrew Morton Sep 26 '20 at 16:40
  • I doubt that logging is the issue. The `PublishRunWebpack` command tries to copy files to another location, of which the destination path is too long. Anyhow I tried replacing the command in the `csproj` file with the following `` and it's still not working – Pieterjan Sep 26 '20 at 17:18
  • What I'm suggesting, in the interests of making it work,is that the subdirectory of "\6a" has a ridiculously unnecessarilly long name and maybe you could find some way of avoiding that problem. – Andrew Morton Sep 26 '20 at 18:06
  • I wish I could, but so far I haven't found a way to do so. It's related to `@nguniversal/express-engine`. Nevertheless, I purchased Windows 10 pro, enabled longpaths, and it's still not working. I can make subfolders with insanely long names using powershell, but apparently Visual Studio cannot – Pieterjan Sep 26 '20 at 18:17
  • 1
    My guess would be that Visual Studio's web deploy simply hasn't opted into the long path API. I would suggest using the integrated feedback mechanism in VS to report this as a defect. – Ian Kemp Sep 26 '20 at 20:32
  • Jup I did so. I also just tried creating folders in the `Solution Explorer` named `ldfjlkdhlkvmncvbmqjlfhqsdlkfqglhdlsfkqghksldfjl`. As expected it throws an error when the path name gets too long (4 subfolders is the maximum possible) so Visual Studio as well does not support long paths, just as Windows Explorer. How disappointing... – Pieterjan Sep 26 '20 at 20:43
  • Off course if `@nguniversal/express-engine` wouldn't have used multiple hashes in the path while running the `npm run build:ssr` script, we wouldn't run into this problem... – Pieterjan Sep 26 '20 at 20:45
  • @IanKemp Indeed, it appears that neither version of Visual Studio 2019 (Community, Professional, Enterprise) has support for LongPaths. Very disturbing... – Pieterjan Sep 28 '20 at 06:27

0 Answers0