| **Navigation:**  Project System >====== Project Redirection Tasks ====== | [[project redirection.htm|{{btn_prev_n.gif|Previous page}}]][[coming future.htm|{{btn_home_n.gif|Return to chapter overview}}]][[global options compile options dialogs.htm|{{btn_next_n.gif|Next page}}]] | | || The Clarion project system uses the MSBuild engine to build projects and solutions. You can add additional tasks to any project. A task available to Clarion developers is the Redirection task. This allows you to get the full path of a file using the redirection system. To use this task in a project you need to add the following line to the top of the project file: **<;UsingTask TaskName="Microsoft.Build.Tasks.Redirection"** **AssemblyFile="$(ClarionBinPath)\SoftVelocity.CW.Build.Tasks.dll"/>** The following table describes the parameters of the Redirection task. | **Parameter** | **Description** | | File | Required String parameter. Specifies the file that should be found via redirection | | | | | Version | Optional String parameter. Specifies the version of Clarion to be used. If not specified, the current version of Clarion is used | | | | | ForOpen | Optional Boolean parameter. If true, OutputPath is set to the path where the file exists. If false, OutputPath is set to the path where the file will be created. If not specified, true is assumed. If ForOpen is true and the file does not exist, OutputPath is set to an empty string. | | | | | RedirectionDirectory | Optional String parameter. The directory where the redirection file is located. If not specified, the current directory is used. | | | | | OutputPath | Optional String output parameter. Contains the full path of the file. | | | | **Example:** The following code example creates a new item collection named //MySourceItemsWithMetadata// from the item collection //MySourceItems//. The //CreateItem// task populates the new item collection with the items in the //MySourceItems// item collection that contain //MyAddMetadata// values of true. It then adds an additional metadata entry named //MyMetadata// with a value of Hello to each item in the new collection. After the task is executed, the //MySourceItemsWithMetadata// item collection contains the items //file1.resx// and //file3.resx//, both with metadata entries for //MyAddMetadata// and //MyMetadata//. The //MySourceItems// item collection is unchanged. | **<;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">** | | ** <;UsingTask TaskName="Microsoft.Build.Tasks.Redirection" AssemblyFile="$(ClarionBinPath)\SoftVelocity.CW.Build.Tasks.dll"/> ** | | **  <;Target Name="FindFile">** | | **   <;Redirection** | | **    File="cwglobals.pi"** | | **    ForOpen=true** | | **    Version="Clarion 6.0 Enterprise Edition"** | | **    RedirectionDirectory="c:\mydatadir">** | | **    <;Output** | | **     TaskParameter="OutputPath"** | | **     PropertyName="FullPath"/>** | | **     <;/Redirection>** | | **     <;Message Text = "File does not exist" ** | | **      Condition="$(FullPath)=""/>** | | **     <;Message Text = "Full Path is $(FullPath)" ** | | **      Condition="$(FullPath)!=""/>** | | **  <;/Target>** | | **<;/Project>** |