問題
在 .NET Build 專案時,會出現以下的錯誤訊息:
The “GenerateStaticWebAssetEndpointsPropsFile” task failed unexpectedly. System.IO.DirectoryNotFoundException: Could not find a part of the path
解法
這通常是因為整個專案的路徑過長(超過 260 ),所以可以參考 Maximum Path Length Limitation 去Enable long paths,例如加 Windows 機碼的設定,如下:
1 | New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force |