Creating and editing publishing tasks is quite similar to publishing a project. Almost all the settings and procedures are really identical. The only difference is that instead of publishing directly, you are saving the publishing instructions to be used again later.
Before you start trying to create publishing tasks you should be familiar with manual publishing. Learn to use conditional output and variables on their own before trying to use them in publishing tasks.
A publishing task is a group of publishing operations that are all performed together. A publishing action is a single publishing operation within a publishing task. You can have more than one action for the same output format in a single task if you want. For example, a task might include three different PDF versions of your project, using different templates and with different content.
Creating a task:
1.Open the Publishing Task Manager and click on the New Task button at the bottom of the task list. This opens the task editing dialog:
2.Type the name of the task in the left box of the top and the name of the first action in the right box.
3.A new task must always have at least one action. Select the action type on the left, then set up your publishing output path/file and options just as you would for normal manual publishing. You can also use Include Options for publishing different versions of your project. See further below for information on setting up custom variables.
4.Click on OK to create the task.
Adding more actions:
To add a new action just click on the "Add New Task Action" item directly below the task. This displays the same dialog as above, in which you can select the task type and define its output options and settings.
Opening the action for editing:
To edit an action in a task just double-click on the action or right-click on it and select Edit Action in the context menu. All the editing operations are the same as for creating a task.
To rename an action open it for editing and click in the action name box at the top of the edit action dialog. Note that you can only rename actions, you cannot rename tasks after creating them!
Until the Publishing Task Manager became available you could only redefine variables with command line publishing. You needed to define an external variable definition file and refer to it in a command line. Now you can redefine the values of any variables in your project for individual publishing actions to individualize each publishing output as you want. For example, if the product name referred to is different in two versions of your documentation, you can redefine your PRODUCTNAME variable (or whatever you have called it).
Redefining just a few variables manually:
1.Make a note of the variable names you want to redefine.
2.Open the action for editing and select the Custom Variables tab.
3.Click on Add and enter the name of the variable you want to redefine.
4.Select the variable type (HTML or Text) and enter its value, just as you would when defining a user variable.
Redefining a large number of variables from a list:
You can also import an edited list of variable definitions. The easiest way to do this is to first export the variables stored in your project to a text file and edit their definitions there. Then you can import the edited file in one easy operation.
1.In the Project Explorer, go to Configuration > Common Properties > Text Variables and use the Export button to export your variables to a text file. See User-defined variables for more information on working with variables.
2.Edit the list of variables in a text editor. You can remove variables from the list by deleting their definition lines and change the variable definitions, but don't try to change the variable names.
3.Open the publishing action for editing, select Custom Variables and use the Import button to import the edited variables list.
Tip: You can also use the Export button to export an edited list of variables from the action for use in other actions!
The Build Events tab allows you to define programs to be executed before and after publishing. For example, you might define a pre-processor that you have programmed yourself to change the content of your project before it is published, or a digital signing tool to sign your output after it has been published.
Adding build events:
Use the Add button in the Build Events tab to add events.
If you set an event before publishing Help+Manual waits for exit code 0 from the last build event before starting. Any program, script or batch file you execute before publishing must deliver a valid exit code when it closes, otherwise Help+Manual will not proceed with the publishing process.
Programs and utilities need to deliver a valid exit code on closing. If you are using a batch file you should always terminate it with the following line to make certain that you have a valid exit code:
EXIT /B %ERRORLEVEL%
Help+Manual will only proceed if it registers and exit code of 0 from the build event. Anything else is interpreted as an error and publishing will not proceed.