The “CollectFilesinFolder” task failed unexpectedly. System.IO.PathTooLongException
This error is thrown during the build due to the node_modules having crazy file path lengths. The easiest way to circumvent this issue is to configure the Layouts and Dynamic Forms modules project file to exclude the node_modules folder. This is quick and easy by adding the ExlcudeFoldersFromDeployment tag in the first property group of each project file.
<PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug<\/Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU<\/Platform> <ExcludeFoldersFromDeployment>node_modules<\/ExcludeFoldersFromDeployment> <\/PropertyGroup>
Once that has been added to those project files, publishing now works. Also with this change my GIT deployments to an Azure Website magically started working too. There seems to be a fix in place according to this Github issue, I am curious if it is the same solution or not.