views:

272

answers:

3

I'm interested in figuring out how to automate a build from Visual FoxPro similar to how we can build .NET projects from the command line using MSBuild.

It seems that it is possible to pass command line arguments to VFP.exe which may include the ability to specify some initial startup prg that runs however it is unclear how well starting up the IDE will work from non-interactive accounts such as the Network Service on Windows which is likely where an automated build would run.

Has anybody attempt this before or read about anybody attempting to script a VFP build like this? I would be grateful for any pointers that may lead me to a solution.

+2  A: 
abmv
+3  A: 

A simple solution is to create a program file that builds the application, and call VFP to execute that program. You can also add any pre or post build commands to that program file.

Create a VFP configuration text file, called BUILD.FPW

SCREEN=OFF
COMMAND=DO C:\Project\BUILD.PRG

Then create C:\Project\BUILD.PRG

Modify Project C:\Project\MyProject Nowait
_vfp.Projects.Item(1).Build("C:\Project\myapp.exe", 3, .f., .f.)
If file("C:\Project\myapp.err")
    * Do something for build errors
Else
    * No errors
Endif
Quit

Finally, to build it

C:\Program Files\Microsoft Visual FoxPro 9\vfp9.exe -CBUILD.FPW

VFP will build it non-interactively. It will log build errors to myapp.err. If it builds successfully, no error file is created.

Chris
+1  A: 

I blogged about a VFP MSBuild Task that I wrote awhile back. You can download the task from here.

Tom Brothers