SlowCheetah not producing transformed config file on CI server
I'm using SlowCheetah to transform an XML config file in a Visual Studio web project on a CI server. In Visual Studio 2010 the XML will transform just fine when I publish, but on the CI server no transformation occures. Instead I just get the original non-transformed config file. I followed the instructions provided by Sayed Ibrahim's Blog where he explains to add the SlowCheetah dll and targets file in the solution and point the project file to use those files. I made this change and did a publish in Visual Studio just to make sure it worked and it did. But when I build the project on the CI server I get the same problem I had before.
My assumption is that it has something to do with my MSBuild script that I'm using to build my project on the CI server. Do I need add something to this to tell my project to use SlowCheetah? My build script is as follows:
<Project DefaultTargets="DoPublish"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SourceFileRootFolder>$(CCNetWorkingDirectory)Code</SourceFileRootFolder>
<WebFolder>DCSIWebDCSIWeb</WebFolder>
<ReleaseFolder>C:BuildsBuildFolder</ReleaseFolder>
</PropertyGroup>
<PropertyGroup Condition ="$(CCNetWorkingDirectory) == ''">
<SourceFileRootFolder>C:BuildsProjectWorkingDirectoryCode</SourceFileRootFolder>
<ReleaseFolder>C:BuildsBuildFolder</ReleaseFolder>
</PropertyGroup>
<Target Name="CleanSource">
<Message Text="Removing all source files from $(ReleaseFolder)" />
<RemoveDir Directories="$(ReleaseFolder)" />
</Target>
<Target Name="DoPublish">
<CallTarget Targets="CleanSource"/>
<MSBuild Projects="$(SourceFileRootFolder)DCSIWeb.sln" Targets="Clean;Build" />
<MSBuild Projects="$(SourceFileRootFolder)$(WebFolder)DCSIWeb.csproj"
Targets="_CopyWebApplication;_BuiltWebOutputGroupOutput;TransformWebConfig"
Properties="OutDir=$(ReleaseFolder)" ></MSBuild>
</Target>
The MSBuild script basically builds the project and places the project in to "c:BuildsBuildFolder". When I look in the build folder after the build has been done I see the .config file I need but no transformation has occurred to it. It's the same file it was before.
Try it with version 2.5.10. Ive modified SlowCheetah to add the .targets file to the project. No extra config required now. More info at https://github.com/sayedihashimi/slow-cheetah/issues/113.
I always dislike that kind of answers but I recommend you to use Config Transformation Tool. It's another tool to use Xdt transformations but it is much simpler then Cheetah and a bit clever (support params) then serious MSBuild Task. It can be just stored in solution or automatically restored on CI server via NuGet package. You just need o call utility with params. I'm a fan of Xdt since in was produced and found this tools as easiest to use in my projects.
链接地址: http://www.djcxy.com/p/62442.html