0

Im running the following command in my pre build event

(get-content "$(SolutionDir)woop.txt") -replace 'HELLO','GOODBYE' | set-content "$(SolutionDir)woop.txt"

however im getting the following error:

The command "(get-content "C:\Users\jonny\Desktop\data\a\woop.txt") -replace 'HELLO','GOODBYE' | set-content "C:\Users\jonny\Desktop\data\a\woop.txt"" exited with code 255.

Any one got any ideas?

Chandu
  • 81,493
  • 19
  • 133
  • 134
Jonathan D
  • 1,364
  • 2
  • 12
  • 30

1 Answers1

1

build events scripts are dos script based, not PowerShell...

I suggest you to wrap your script in a ps1 file, then executing powershell.Exe with the proper arguments.

EDIT

This article shows how to do it.

Steve B
  • 36,818
  • 21
  • 101
  • 174