I am currently updating my Orbiter build toolset from VS2008 to VS2015.
While the transition worked surprisingly smoothly in terms of the actual code, I ran into a strange problem with a custom build step that has confounded me all day. I've run out of ideas, so here it is, in case somebody has a suggestion.
The custom build step compiles the LaTeX sources for the documents in the Doc\Technotes folder. It looks like this:
(Don't worry about the various path macros. They specify the source, build and deploy directories and I checked that they are expanded correctly.)
This build script works ok in VS2008, and it works nearly in VS2015, except for the last command that converts the intermediate PS file to PDF. This just fails with a 255 error code and doesn't produce any output. If I execute the last line manually in a command shell (with expanded macros) it works ok.
I even tried to pipe the entire script into a bat file on the fly and run that from the custom build step, with the same result. If I run the generated bat file manually outside the VS IDE, it works flawlessly.
I checked that the ps2pdf executable is found within the custom build environment.
I tried to combine the DVI -> PS -> PDF conversion into a single DVI -> PDF step using the dvipdf command, with the same result.
What does work is using pdflatex to generate PDF output directly from the sources. Unfortunately this doesn't work if the LaTeX code includes EPS figures, which I have.
So can anybody think of a reason why the ps2pdf utility doesn't work inside the VS2015 IDE? Are there particular restrictions on what can be used in the custom build step? I am using the MiKTeX 2.9 installation for my LaTeX compiler. Often ps2pdf is implemented as a batch file calling gs (ghostscript) with a predefined set of parameters, but in this case it's an exe (possibly a wrapper for another exe). I thought it might be running up against my virus scanner, but why would it then run without problems outside the IDE?
While the transition worked surprisingly smoothly in terms of the actual code, I ran into a strange problem with a custom build step that has confounded me all day. I've run out of ideas, so here it is, in case somebody has a suggestion.
The custom build step compiles the LaTeX sources for the documents in the Doc\Technotes folder. It looks like this:
Code:
if not exist "$(ObjectDir)\latex" mkdir "$(ObjectDir)\latex"
if not exist "$(OrbiterDocDir)\Technotes" mkdir "$(OrbiterDocDir)\Technotes"
cd "%(RootDir)%(Directory)"
latex -aux-directory="$(ObjectDir)\latex" -output-directory="$(ObjectDir)\latex" "%(FullPath)"
bibtex "$(ObjectDir)\latex\%(Filename)"
latex -aux-directory="$(ObjectDir)\latex" -output-directory="$(ObjectDir)\latex" "%(FullPath)"
latex -aux-directory="$(ObjectDir)\latex" -output-directory="$(ObjectDir)\latex" "%(FullPath)"
dvips "$(ObjectDir)\latex\%(Filename).dvi" -o "$(ObjectDir)\latex\%(Filename).ps"
ps2pdf "$(ObjectDir)\latex\%(Filename).ps" "$(OrbiterDocDir)\Technotes\%(Filename).pdf"
(Don't worry about the various path macros. They specify the source, build and deploy directories and I checked that they are expanded correctly.)
This build script works ok in VS2008, and it works nearly in VS2015, except for the last command that converts the intermediate PS file to PDF. This just fails with a 255 error code and doesn't produce any output. If I execute the last line manually in a command shell (with expanded macros) it works ok.
I even tried to pipe the entire script into a bat file on the fly and run that from the custom build step, with the same result. If I run the generated bat file manually outside the VS IDE, it works flawlessly.
I checked that the ps2pdf executable is found within the custom build environment.
I tried to combine the DVI -> PS -> PDF conversion into a single DVI -> PDF step using the dvipdf command, with the same result.
What does work is using pdflatex to generate PDF output directly from the sources. Unfortunately this doesn't work if the LaTeX code includes EPS figures, which I have.
So can anybody think of a reason why the ps2pdf utility doesn't work inside the VS2015 IDE? Are there particular restrictions on what can be used in the custom build step? I am using the MiKTeX 2.9 installation for my LaTeX compiler. Often ps2pdf is implemented as a batch file calling gs (ghostscript) with a predefined set of parameters, but in this case it's an exe (possibly a wrapper for another exe). I thought it might be running up against my virus scanner, but why would it then run without problems outside the IDE?