How to automate a build for a Visual FoxPro project?
Asked Answered
W

2

12

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.

Woolgathering answered 25/5, 2010 at 14:37 Comment(0)
A
22

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.

Actium answered 25/5, 2010 at 19:49 Comment(2)
I think this is the answer I need but FoxPro was soooo long ago for me. When I do exactly what you say above I get: 1689 Cannot build without a main program. What is C:\Project...Project root or where all my prg files live or...???Payee
@ GPGVM: the parameter for the modify project command is the full pathname of an existing project file, in this case C:\Project\MyProject; the extension '.pjx' is implied and may be omitted. If the path contains blanks then it must be enclosed in quote characters (e.g. modify project 'c:/subdir/name containing blanks' nowait).Creak
N
3
Nightjar answered 25/5, 2010 at 14:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.