We’ve been running this script fine previously, but recently we’ve been getting some issues (See below error) with our config transform step from our TFS Build.
$serviceFiles = Get-ChildItem $localWorkspace -Recurse | where {$_.Extension -eq ".exe"}
We recently switched to using Gulp to compile our CSS and JS which has given us a “node_modules” folder. It looks like it’s trying to crawl these folders and actually gets to the directory length limit. I’ve tried various suggestions I’ve found from googling and other related questions on SO, but none seem to be working for me, it’s still hitting the same error (and I assume isn’t actually excluding these folders)
This is an example of a modified version I've tried using to exclude the folders
$excludedDirectories = @("*node_modules*", "*packages*", "*Common*");
Write-Verbose $localWorkspace
# get services for config types (service configs named same as assmebly .exe)
$serviceFiles = Get-ChildItem $localWorkspace -Recurse -Exclude $excludedDirectories | ?{$_.Extension -eq ".exe" -and $_.FullName -notmatch '*node_modules*' }
I've tried some variations on this based on other SO questions and answers, but the solution evades me. I've read from a few sources that the -Exclude
doesn't work for a lot of people in most situations, so i tried the solution of a where clause to exclude a folder (I want to exclude multiple, but I tried just node_modules to see if I could get it past that, the other folders aren't too deep)
I want to exclude the node_modules directory, along with a couple of others that don't need to be checked for a transform. Any help would be greatly appreciated, thank you.