问题
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
回答1:
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.
回答2:
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"
来源:https://stackoverflow.com/questions/19404266/can-you-call-slow-cheetah-from-the-command-line