Building from Commandline
In addition to the easy to use drag-and-drop interface, wyBuild offers a commandline interface for more advanced users. With this commandline interface you can build your updates and add new versions using an XML file.
These are the available commandline switches:
| Commandline switch | Description |
|---|---|
| bu | Build the updates & server files for your project. |
| bwu | Build wyUpdate for the latest version of your app. |
| vs | The start version - the version of your product that you're building from. If this switch is not present then the update is built from the oldest available version. |
| ve | The end version - the version of your product that you're building to. If this switch is not present then the update is built to the newest available version. |
| add | Add additional versions to your product using the XML specification below. |
| showui | Show the UI of the batch progress. Otherwise the progress and any errors will be printed in the console window. |
Return codes
When you're not using the "-showui" switch wyBuild returns 0 on success (updates and/or wyUpdate built successfully) and 1 on error.
Building updates
Building updates from commandline is simple a matter of supplying the version ranges of the update you want to build:
wybuild.exe "C:\YourProject.wyp" /bu
Or you can specify the version ranges you want to cover with the update:
wybuild.exe "C:\YourProject.wyp" /bu -vs="1.0" -ve="1.1"
Adding new versions
You can add new versions to your wyBuild project by using either the "/bu" or "/bwu" commandline switch along with the "-add" switch. For example:
wybuild.exe "C:\YourProject.wyp" /bu -vs="1.0" -ve="1.2" -add="newversions.xml"
This adds the new version using the xml specification (see below) while also building the updates for your product in the range from v1.0 to v1.2.
New Versions XML Format
The format of the XML file required to add new versions by commandline is rather simple. Below is an example:
<?xml version="1.0" encoding="utf-8"?>
<Versions>
<AddVersion>
<Version>1.2</Version>
<Changes>Some very very cool stuff</Changes>
<InheritPrevRegistry />
<Files dir="basedir">
<File source="C:\YourProduct\1.2\YourProduct.exe" />
<File source="C:\YourProduct\1.2\Awesome.dll">NewName.dll</File>
<Files dir="Sub folder">
<File source="C:\YourProduct\1.2\Sub folder\File.dat" />
</Files>
</Files>
<Files dir="sys32\YourProduct">
<File source="C:\YourProduct\1.2\AnotherFile.dll" />
</Files>
</AddVersion>
</Versions>
Available destination directories
The Files blocks (<Files dir="basedir"> ... </Files>) have a dir attribute which corresponds to destination directory:
| Directory Abbreviation | Destination |
|---|---|
| basedir | The directory where your program is installed (e.g. C:\Program Files\YourProgram) |
| commdesktop | The common desktop. |
| commstartmenu | The common start menu. |
| commappdata | The common application data directory. |
| currappdata | The current user's application data directory (e.g. C:\Users\User Name\AppData) |
| commonfilesx86 | The Common Files directory for 32-bit
|
| commonfilesx64 | The Common Files directory for 64-bit
|
| sys32 | The system32 directory for 32-bit
|
| sys32x64 | The system32 directory for 64-bit
|
| root | The root Windows drive (e.g. C:\) |
| temp | The temporary directory. |
Removing & overwriting existing versions
You can also remove and overwrite existing versions in your wyBuild project file. To overwrite an existing version if it exists simply add the overwrite="true" attribute to the <AddVersion> element:
<?xml version="1.0" encoding="utf-8"?>
<Versions>
<AddVersion overwrite="true">
<Version>1.2</Version>
...
</AddVersion>
</Versions>
You can also explicitly remove versions:
<?xml version="1.0" encoding="utf-8"?>
<Versions>
<RemoveVersion ver="1.1" />
<AddVersion>
<Version>1.2</Version>
...
</AddVersion>
</Versions>
If you would like wyBuild to show an error if you try to remove a version that doesn't exist then use the hardfail="true" attribute:
<RemoveVersion ver="1.1" hardfail="true" />
Executing files
As shown in Executing files in your update you can execute *.exe, *.bat, *.cmd, and *.msi files either before or after you've installed your update.
| File Attribute | Description |
|---|---|
| execute | The "execute" attribute is required if you want to execute files. It can have one of 2 possible values:
|
| waitforexit | Set this attribute to true if you want wyUpdate to wait for the program to finish before continuing with the update. Set it to false otherwise.If this attribute is absent, the default value is true. |
| startstyle | The "startstyle" attribute lets you set how the executable is started. It can have one of 4 possible values:
normal. |
| commandline | Any additional commandline options you want to pass to your executable. |
Here's a simple example showing a program being executed before the update takes place:
...
<Files dir="temp">
<File source="C:\YourProduct\1.2\SpecialFunctions.bat" execute="before" startstyle="hidden" commandline="--folder="%basedir%\Important Stuff"" />
</Files>
...
Building wyUpdate
To build wyUpdate.exe and client.wyc for the latest version of your software simply use the "/bwu" commandline argument:
wybuild.exe "C:\YourProject.wyp" /bwu
Or you can specify the version you want to create wyUpdate for:
wybuild.exe "C:\YourProject.wyp" /bwu -ve="1.1"
Bringing it altogether
You can also do everything in one step:
wybuild.exe "C:\YourProject.wyp" /bwu /bu -vs="1.0" -ve="1.2" -add="newversions.xml"
In this example we add a new version, create wyUpdate, and build the updates from 1.0 through 1.2.