0

Horrendous day with TeamCity and PowerShell ends with

NamedParameterNotFound
Get-ChildItem : A parameter cannot be found that matches parameter name 'File'.
$files = Get-ChildItem -Path $RootFolderPath -Filter $CodeFilename -File -Recurse

The offending line (above, bottom) is in a PS1 being ran by TeamCity.

The script runs beautifully on my local dev machine and the PS version on TC server is 4.0 apparently, and I can see the -File param in a PS command window on the TC server itself.

How on Earth can the -File parameter be missing from Get-ChildItem??

Luke Puplett
  • 42,091
  • 47
  • 181
  • 266

1 Answers1

0

In the "Script arguments" box in TeamCity, I

changed this

-RootFolderPath '%teamcity.build.checkoutDir%' -VersionString '%AssemblyVersionStringWithCounter%'

to this

-RootFolderPath %teamcity.build.checkoutDir% -VersionString %AssemblyVersionStringWithCounter%

And it works. Lord knows.

Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
  • Are you sure you can reproduce it by simply removing the quotes again? Or just unquoting one of the quoted values? Does either of them contain spaces? – sferencik Nov 26 '15 at 19:05