使用msdeploy转换文件 [英] Transforming files with msdeploy

查看:89
本文介绍了使用msdeploy转换文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用MSDeploy的配置转换机制来转换其他文件吗?

Can I use the config transforms mechanism of MSDeploy to transform other files?

推荐答案

(另一种方法)

在为您的项目运行MSbuild时,会调用jsut msdeploy打包.

The msdeploy packaging is jsut invoked during an MSbuild run for your project.

TransformXml 是.csproj或.vsproj构建的随附任务.

TransformXml is an included task of a .csproj or .vsproj build.

只需修改您的构建过程即可在所需的任何文件上调用该任务.

Just modify your build process to invoke that task on whatever file you need.

例如,我们要做的是编写一个自定义目标

For example, what we do is write a custom target

<Target Name="TransformFile">

    <TransformXml Source="$(DestinationPath)\$(Sourcefile)" 
       Transform="$(DestinationPath)\$(TransformFile)" 
       Destination="$(DestinationPath)\$(DestFile)" />
    </Target>

然后在调用Publish任务之前修改.csproj使其运行.

Then modify your .csproj to run this BEFORE the Publish task is invoked.

<CallTarget Targets="TransformFile" 
   Condition="'$(CustomTransforms)'=='true'" />

这篇关于使用msdeploy转换文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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