microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.84k stars 321 forks source link

Unable to copy file issues in WinUI Desktop app #1528

Open KanniyappanP opened 3 years ago

KanniyappanP commented 3 years ago

Describe the bug

We have a WinUI Desktop application with a class library, but when we try to build it, we get the error "Unable to copy class library files (used .xaml or.txt files) files when compiling WinUI Desktop project." It occurs as a result of accessing files with long file paths and running projects in long directories. The reported issue does not occur if I move the project location closer to the root directory. Can you please confirm whether this is a bug or expected behavior in WinUI? If this is a bug, any suggestions for a workaround would be greatly appreciated.

Please find the issue details below.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Microsoft\DesktopBridge\Microsoft.DesktopBridge.targets(805,5): error MSB3021: Unable to copy file "C:\Users\Public\Documents\Kanniyappan\WinUI\19.3.0.43\SampleBrowser\WinUIClassLibrary\obj\Debug\net5.0-windows10.0.19041.0\Views\Getting started\GettingStarted.xaml" to "C:\Users\Public\Documents\Kanniyappan\WinUI\19.3.0.43\SampleBrowser\WinUIDesktopAppTest\WinUIDesktopAppTest\WinUIDesktopAppTest (Package)\bin\x86\Debug\Microsoft.SampleBrowser.WinUI_Net50\Microsoft.ClassLibrary.WinUIDemos_Net50\Views\Getting started\GettingStarted.xaml". 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. 3>Done building project "Microsoft.SampleBrowser.WinUI_Net50 (Package).wapproj" -- FAILED.

Steps to reproduce the bug

  1. Build the attached sample.
  2. Note unable to copy issues occurred. 3.SampleBrowser.zip

Expected behavior Please confirm whether the copying problems in WinUI are a bug or a limitations/expected of WinUI.

Screenshots Errors details are shared as code snippet.

Version Info

NuGet package version: [Microsoft.WindowsAppSDK 0.8.1]

OS Version: Windows 10 20H2 (19042.1237)

Windows version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)

Additional context

asklar commented 3 years ago

Make sure you've turned on long path support: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later

YuvarajMasilamani commented 1 year ago

I am experiencing the same problem. I tried the approach recommended, but I received a DEP 1000 error.