tags:

views:

793

answers:

3

I'm trying to exec a VS build using incredibuild within my ANT script, but For some reason the exec task fails with the following error:

'Win32' is not recognized as an internal or external command

when I use the following code:

<arg line='buildconsole solution.sln /rebuild /cfg="Release|Win32"' />

I think the ant script may be treating the '|' as a delimter or something...

Any ideas how I could get this to work?

I've also tried the following, but nothing gets me closer:

<arg line='buildconsole solution.sln /rebuild /cfg="Release&#124;Win32"' />

<arg value="buildconsole solution.sln /rebuild /cfg=&quot;Release|Win32&quot;" />

<arg value="buildconsole solution.sln /rebuild /cfg=&quot;Release&#124;Win32&quot;" />
A: 

I think the problem is that the Windows command prompt sees the | and treats it as a "pipe" operator. Perhaps escape the pipe by using:

<arg line='buildconsole solution.sln /rebuild /cfg="Release\|Win32"' />

Jacob B
+1  A: 

You need to escape the pipe symbol by preceding it with ^. So:

<arg line='buildconsole solution.sln /rebuild /cfg="Release^|Win32"' />


EDIT:

Are you sure the caret doesn't work? It seems to in this sample ant file:

<?xml version="1.0" encoding="UTF-8"?>

<project name="Test" default="build" basedir=".">

    <target name="build">
        <exec executable="cmd">
            <arg line="/k echo cfg=&quot;Release^|Win32&quot;"/>
        </exec>
    </target>

</project>
Kevin
+1  A: 

Hmm... I just tried it again and it worked, but only after I changed to

<arg value="buildconsole solution.sln /rebuild /cfg=Release^|Win32" />

so I guess the quotes around Release^|Win32 wasn't necessary if I use value.

Thanks a bunch!

Michael