0

I'm using Visual Studio Online for CI. I have a Release build set up. One of my projects has a pre build step which should only be executed for Debug builds.

if $(ConfigurationName) == Debug copy "$(ProjectDir)Config\web.$(Username).config" "$(ProjectDir)\runtime.config"

However VSO fails the build with an error that the command exited with a status of 1.

The same build runs fine when executed using Visual Studio on a developers machine.

keitn
  • 1,288
  • 2
  • 19
  • 43

2 Answers2

0

The issue was down to needing brackets on the condition check. Therefore the following works on VSO.

if ($(ConfigurationName) == Debug) copy "$(ProjectDir)Config\web.$(Username).config" "$(ProjectDir)\runtime.config"

The brackets are not required for VS2013.

keitn
  • 1,288
  • 2
  • 19
  • 43
0

The command must be between parentheses, because is parsed by CMD.EXE

if $(ConfigurationName) == Debug ( copy "$(ProjectDir)Config\web.$(Username).config" "$(ProjectDir)\runtime.config" )

See "if".

Giulio Vian
  • 8,248
  • 2
  • 33
  • 41