3

I'm looking to use the fileUpdate task from msbuildtasks.tigris.org to modify image src's as part of our web setup project so that they will point to a static img sub domain (or later a CDN)
I can run a task within a given project with:

<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
<Target Name="AfterBuild">
<FileUpdate 
   Files="basic.css" 
   Regex="/images/([^\)]*)" 
   ReplacementText="http://img.domain.com/images/$1" />
</Target>

However, I dont want to overwrite the original css source file, but want to run this as part of our deployment project that produces an msi. This is done using a web setup project (.vdproj) which also uses a custom actions project which is just a standard .csproj

My questions are:

  1. How can I run this task in the setup project so that I replace content in the files that go into the .msi?
  2. Is there a way to use wildcards for the files - ideally I want to say do this for ALL .css files?
abatishchev
  • 98,240
  • 88
  • 296
  • 433
steve
  • 778
  • 1
  • 8
  • 18

1 Answers1

12

In order to achieve this you need to use an item group to create the list for you

<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" /> 
<Target Name="AfterBuild"> 

<ItemGroup>
   <CssFiles Include='$(SolutionRoot)\**\*.css' />
</ItemGroup>

<FileUpdate  
   Files="@(CssFiles)"  
   Regex="/images/([^\)]*)"  
   ReplacementText="http://img.domain.com/images/$1" /> 
</Target>
Simon
  • 33,714
  • 21
  • 133
  • 202
krystan honour
  • 6,523
  • 3
  • 36
  • 63