views:

452

answers:

1

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 question is:
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?

Thanks for your help

+1  A: 

In order to acheive 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>
krystan honour