msbuild文件更新安装项目 [英] msbuild fileupdate setup project

查看:241
本文介绍了msbuild文件更新安装项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用msbuildtasks.tigris.org中的fileUpdate任务来修改图像src,这是我们的Web安装项目的一部分,以便它们将指向静态img子域(或更高版本的CDN).
我可以使用以下命令在给定项目中运行任务:

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>

但是,我不想覆盖原始的CSS源文件,但是希望将其作为产生msi的部署项目的一部分来运行. 这是通过网络设置项目(.vdproj)完成的,该项目还使用了仅是标准.csproj

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

我的问题是:

  1. 如何在安装项目中运行此任务,以便替换.msi文件中的内容?
  2. 是否可以对文件使用通配符-理想情况下,我想对所有.css文件使用通配符?

推荐答案

要实现此目的,您需要使用项目组来为您创建列表

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>

这篇关于msbuild文件更新安装项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆