0

I have a simple batch script running the command line in the pre-build event is just

C:\path\to\batch\script\PreBuildGenANTLR.bat

The batch script contains

@echo off pushd ..\..\Parser java -jar ..\ANTLR\antlr-3.5-complete.jar -o .ANTLR ExprCppTree.g popd

I've tried exit 0 exit \b 0 SET ERRORLEVEL = 0 but it seems like no matter what I do the script runs but the build stops and errors out with error MSB3073 exited with code -1. I've tried a bunch of other things to make this script return zero including the steps outlined at http://blogs.msdn.com/b/astebner/archive/2006/08/08/691849.aspx . Still nothing. The script runs with a bunch of warnings but no errors. It does what it's supposed to do but still the build stops and exits with code -1. What in the heck am I doing wrong? How can I make it return zero and continue the build?

  • Are you **`call`** ing the batch script from the pre-build event? `call C:\path\PreBuildGenANTLR.bat` Is the java command returning the -1 exit code? Might try catching the exit code. `java -jar ..\ANTLR\antlr-3.5-complete.jar -o .ANTLR ExprCppTree.g || verify >nul` Also at the end of the script use `exit /b 0`. – David Ruhmann Mar 06 '14 at 14:44
  • No. Like I said the script is running and doing everything properly when I run it from cmd but for some reason when I put it into vsStudio it returns -1 – user3388478 Mar 06 '14 at 14:48

1 Answers1

1

In Visual Studio 2010, all you need to do is use the NuGet Package Manager to install the Antlr3 package (make sure the Id listed for the package is exactly Antlr3). With the package installed, to compile a grammar you just need to select the .g or .g3 file(s) in your project and set the Build Action property to Antlr3.

Sam Harwell
  • 97,721
  • 20
  • 209
  • 280