BuildUpdate Task
Creates and publishes an update, given an AppLife Update project and (optionally) locations to publish the update.
Parameters
ProjectFile |
Required String parameter.
Specifies the AppLife Update project used to create the update. |
UpdateVersionSource |
Optional String parameter.
Specifies the update’s version. This parameter can either be a version (e.g. “2.1.0”) or the path to a built .NET assembly. If it is a path to an assembly, the update’s version will be set to the assembly version of that file.
|
PublishLocations |
Optional ITaskItem[] parameter.
Specifies the locations to which the update will be published. If no locations are specified, the set of locations used last time an update was created in the project are reused.
If <UserName> or <Password> metadata is associated with a location, it will be used to log in to that location. |
TargetType |
Optional String parameter.
Determines what versions the created update can be applied to.
Current reuses the last-used target version list in the project. All causes the update to apply to all versions. Last causes the update to target only the version of the last created update. Custom sets the target list to the value of the CustomTargets parameter. |
CustomTargets |
Optional String parameter.
A comma-delimited list of the versions the update will target, if TargetType is set to Custom. Versions can be prefixed with a “>” symbol to indicate that any higher versions should also be targeted.
For example, “2.0,3.0,>5.0” would cause the update to target version 2.0, version 3.0, version 5.0 and any version higher than 5.0. |
SummaryFile |
Optional String parameter.
Specifies the location of a text file containing summary information about the update. |
CustomDataFile |
Optional String parameter.
Specifies the location of a text file containing custom data to be included with the update. |
TestOnly |
Optional Boolean parameter.
Specifies whether the update will be only available to testers, or available to all users. |
ActionBaseDirectory |
Optional String parameter.
Specifies a directory to be used as the base directory for some file actions. |
AppLifeUpdateCmdLocation |
Optional String parameter.
Specifies the directory where AppLifeUpdateCmd.exe is located. If AppLife Update is installed on the system where this task is used, this command should not be needed. |
Examples
To use this task in your project, you must include a UsingTask element in your build file, usually .csproj or .vbproj (<AppLifeUpdatePath> should be replaced with the location of AppLife Update):
<UsingTask AssemblyFile="<AppLifeUpdatePath>\Kjs.AppLife.Update.BuildUpdateTask.dll" TaskName="Kjs.AppLife.Update.MSBuild.BuildUpdate" />
This will allow you to use the task later in your project.
The following example demonstrates publishing an update to two locations saved in a project file, named “InternalServer” and “PublicUpdateServer”:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile="<AppLifeUpdatePath>\Kjs.AppLife.Update.BuildUpdateTask.dll" TaskName="Kjs.AppLife.Update.MSBuild.BuildUpdate" />
<Target Name="CreateUpdate">
<BuildUpdate
ProjectFile="UpdateProject.aup"
UpdateVersionSource="4.0.0"
PublishLocations="InternalServer;PublicUpdateServer" />
</Target>
</Project>
The following example demonstrates publishing an update to one explicitly specified location that requires credentials:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile="<AppLifeUpdatePath>\Kjs.AppLife.Update.BuildUpdateTask.dll" TaskName="Kjs.AppLife.Update.MSBuild.BuildUpdate" />
<ItemGroup>
<PublishUpdate Include="http://example.com/updates/myproject/">
<UserName>ExampleUser</UserName>
<Password>ExamplePass</Password>
</PublishUpdate>
</ItemGroup>
<Target Name="CreateUpdate">
<BuildUpdate
ProjectFile="UpdateProject.aup"
UpdateVersionSource="4.0.0"
PublishLocations="@(PublishUpdate)" />
</Target>
</Project>
The following example demonstrates how to modify a Visual Studio project file so that updates are created automatically as part of the build process:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Project content, including PropertyGroups, ItemGroups, etc. is omitted here for brevity. -->
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!--
<Target Name="BeforeBuild">
</Target>
-->
<<UsingTask AssemblyFile="<AppLifeUpdatePath>\Kjs.AppLife.Update.BuildUpdateTask.dll" TaskName="Kjs.AppLife.Update.MSBuild.BuildUpdate" />
<ItemGroup>
<PublishUpdate Include="http://example.com/updates/myproject/">
<UserName>ExampleUser2</UserName>
<Password>ExamplePass2</Password>
<InProject>false</InProject>
<!-- The InProject metadata must be set to false to prevent
this location from appearing in Solution Explorer. -->
</PublishUpdate>
<PublishUpdate Include="InternalServer">
<Password>ExamplePass</Password>
<InProject>false</InProject>
</PublishUpdate>
</ItemGroup>
<Target Name="AfterBuild">
<!-- Specify a Condition attribute on the BuildUpdate task to ensure that we only create
updates when building in a specific configuration-- in this case, "Release." -->
<BuildUpdate
Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
ProjectFile="UpdateProject.aup"
UpdateVersionSource="$(OutputPath)\$(AssemblyName).exe"
TestOnly="false"
PublishLocations="@(PublishUpdate)" />
</Target>
</Project>