Can you call Slow Cheetah from the command line?

2019-05-11 16:11发布

Can you call Slow Cheetah from the command line? I am looking to add a post build event to transform my config file for a variety of different environments.

Cheers Dee

2条回答
beautiful°
2楼-- · 2019-05-11 16:39

Step 1) Create a build file Transform.msbuild

<Project ToolsVersion="4.0" DefaultTargets="TransformConfiguration" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <UsingTask TaskName="TransformXml"
             AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>

    <Target Name="TransformConfiguration">
    <TransformXml Source="$(sourceConfig)"
                  Transform="$(valuesConfig)"
                  Destination="$(outputConfig)"/>
    </Target>
</Project>

Step 2) Call MsBuild

msbuild Transform.msbuild /p:sourceConfig="app.config" /p:valuesConfig="App.Production.config" /p:outputConfig="AppName.config"
查看更多
一纸荒年 Trace。
3楼-- · 2019-05-11 17:02

I had an issue with

    AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll"

Changing that to

    AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.targets"

Allows it to run more dynamically without having to ever change the version.

查看更多
登录 后发表回答