Updating multiple files with File.Replace

Jun 13, 2008 at 10:28 AM
Hi, I'm trying to update a bunch of files with te File.Replace task but it throws an error at me.
This is what i've got:
<CreateItem Include="*.config">
     <Output TaskParameter="Include" ItemName="ConfigFiles" />
</CreateItem>
<File.Replace
     Path="@(ConfigFiles)"
     OldValue="#REQUIRED_CLIENT_VERSION#"
     NewValue="$(RequiredClientVersion)"
     Force="true"
     />

The error I get back is File not found: a.config;b.config
Suggestions anyone?

- Jonas
Jun 13, 2008 at 10:38 AM
Never mind, I fixed it myself.

<CreateItem Include="*.config">
     <Output TaskParameter="Include" ItemName="ConfigFiles" />
</CreateItem>
<File.Replace
     Path="%(ConfigFiles.Identity)"
     OldValue="#REQUIRED_CLIENT_VERSION#"
     NewValue="$(RequiredClientVersion)"
     Force="true"
     />
Developer
Jun 13, 2008 at 10:43 AM
And depending on your process, you may want to add a condition like Condition="%(ConfigFiles.Identity) != ''" in case no config files exist.

JonasSamuelsson wrote:
Never mind, I fixed it myself.

<CreateItem Include="*.config">
     <Output TaskParameter="Include" ItemName="ConfigFiles" />
</CreateItem>
<File.Replace
     Path="%(ConfigFiles.Identity)"
     OldValue="#REQUIRED_CLIENT_VERSION#"
     NewValue="$(RequiredClientVersion)"
     Force="true"
     />