3

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

4

2 回答 2

7

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"
于 2014-12-16T01:48:16.090 回答
2

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.

于 2015-05-01T19:16:11.457 回答