Config Transforms and CruiseControl.net - cruisecontrol.net

How is it possible to Transform configuration from a CruiseControl.net build?
I have the following in my CC project (snipped for brevity):
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
<buildArgs>/noconsolelogger /P:TransformConfigFiles=true /p:Configuration=Development /v:diag</buildArgs>
</msbuild>
Where “Development” is the name of the configuration build. Is “TransformConfigFiles” actually the correct command line argument?
The CC project executes without error, it’s just that actual transform doesn’t happen. It’s meant to replace the connection string. Here’s the transform config:
Web.Development.config using "set attributes" transform:
<add name="DbConnectionNameHere" connectionString="myConnectionHere" providerName="System.Data.SqlClient" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
Thanks

I've never seen that (/P) parameter (TransformConfigFiles). That doesn't mean I'm omniscient.
Check this one out:
web.config file transform from command line
I think the below substantiates my guess about "TransformConfigFiles":
TFS 2012 and web.config transforms

Related

Server Error in '/ccnet' Application

My CCTray says build is broken and on the server(http://172.25.165.10/ccnet/)
I get this error
Server Error in '/ccnet' Application.
Configuration Error
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<!-- This is your CruiseControl.NET Server Configuration file.
Add your projects below! -->
<project name="winapp"
description="demoproject showing a small config" queue="Q1">
<webURL>http://172.25.165.10/ccnet/</webURL>
<!-- specify a state folder to prevent CCNet from saving it in Program Files\CruiseControl.NET\server
programs may not standard write their data in it on windows Vista and up)
-->
<sourcecontrol type="svn">
<trunkUrl>https://citdevbox.arcade.local:8443/svn/cardwellR/trunk/winapp</trunkUrl>
<workingDirectory>c:\builds\winapp</workingDirectory>
<username>***</username>
<password>***</password>
</sourcecontrol>
<state type="state" directory="C:\CCNet\State" />
<!-- specify a artifactDirectory to prevent CCNet from saving it in Program Files\CruiseControl.NET\server
programs may not standard write their data in it on windows Vista and up)
-->
<artifactDirectory>C:\CCNet\BuildArtifacts\MyFirstProject</artifactDirectory>
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\\v3.5\MSBuild.exe</executable>
<projectFile>C:\Builds\build\BootStrapper.msbuild</projectFile>
<buildArgs>/noconsolelogger /t:CTSx86;BuildZip /v:d</buildArgs>
<logger>ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
<timeout>900</timeout>
</msbuild>
</tasks>
<triggers>
<!-- check the source control every X time for changes,
and run the tasks if changes are found -->
<intervalTrigger
name="continuous"
seconds="300"
buildCondition="IfModificationExists"
initialSeconds="5"/>
</triggers>
<publishers>
<xmllogger />
<artifactcleanup cleanUpMethod="KeepLastXBuilds"
cleanUpValue="50" />
</publishers>
</project>
</cruisecontrol>
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The root element must match the name of the section referencing the file, 'appSettings'
Source Error:
Line 1: cruisecontrol xmlns:cb="urn:ccnet.config.builder"
Source File: C:\Program Files (x86)\CruiseControl.NET\server\ccnet.config Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.5456; ASP.NET Version:2.0.50727.5456
You didn't post the content of your ccnet.config file which the error you are getting is complaining about. Lets start with the obvious. I would look to see if there is a typo in there, for example maybe a missing quote or something in the appSettings section. If you have the unmodified version revert back to that and see if your issue goes away and compare the unmodified with the modified.
There is an app called CCValidator which will tell you where the error is in your ccnet.config file. I suspect that is not where the problem is. It sounds like the error is in the ccservice.exe.config. Perhaps someone accidentally copied ccnet.config to ccservice.exe.config. The error may also be in your web dashboard's configuration.
I solved the issue by removing the build args tag.
</noconsolelogger /t:CTSx86;BuildZip /v:d>
My processor was 64 bit and I was using noconsolelogger /t:CTSx86 which is for a 32 bit processor. Anyway these were optional so I removed it worked fine.

Transform external config in a web role

Can slowcheetah transform an external config file in an azure web role? e.g. I have logging info in log4net.config. But the transformed version does not get created when packaged.
I did not manage to get slowCheetah working in my Azure solution.
One alternative you can use is to create complete config files for each environment - e.g. :
log4net.debug.config
log4net.release.config
and copy the contents of these into the log4net.config at buildtime depending on the build configuration chosen.
This is done by adding a build target to your csproj file like so:
<Target Name="BeforeBuild">
<Delete Files="$(ProjectDir)log4net.config" />
<Copy SourceFiles="$(ProjectDir)log4net.$(Configuration).config"
DestinationFiles="$(ProjectDir)log4net.config" />
</Target>
(you may have to modify the paths in the script depending on where in the solution your config files are)
You can find more information on MSBuild and manipulating your .csproj file here and here

cruisecontrol <buildargs> nant parameter not being passed

I've been trying to use the param in my cruisecontrol build config file to no avail. When checking the cruisecontrol log file, whatever buildargs I try to pass are NOT passed to the call to nAnt.
Here's the nant task:
<nant>
<buildArgs>-D:CCFoo="Unknown" -D:foo="$(foo)"</buildArgs>
<executable>C:\MCR\Trunk\BuildLibrary\NAnt.exe</executable>
<baseDirectory>C:\MCR\Trunk\tek.Build</baseDirectory>
<buildFile>tek.build</buildFile>
<targetList>
<target>cc</target>
</targetList>
<buildTimeoutSeconds>1800</buildTimeoutSeconds>
</nant>
Here's what appears in the logfile for that call to nant:
2010-01-28 08:45:12,815 [TekWebsite:DEBUG] Starting process [C:\MCR\Trunk\BuildLibrary\NAnt.exe] in working directory [C:\MCR\Trunk\tek.Build] with arguments [-nologo -buildfile:tek.build -logger:NAnt.Core.XmlLogger -D:CCNetArtifactDirectory="C:\Program Files (x86)\CruiseControl.NET\server\builds" -D:CCNetBuildCondition=ForceBuild -D:CCNetBuildDate=2010-01-28 -D:CCNetBuildTime=08:45:12 -D:CCNetFailureUsers= -D:CCNetIntegrationStatus=Unknown -D:CCNetLabel=50 -D:CCNetLastIntegrationStatus=Failure -D:CCNetListenerFile="C:\Program Files (x86)\CruiseControl.NET\server\builds\ClarksWebsite_ListenFile.xml" -D:CCNetModifyingUsers= -D:CCNetNumericLabel=50 -D:CCNetProject=TekWebsite -D:CCNetProjectUrl=http://cor-str-mcr08/ccnet/server/local/project/TekWebsite/ViewProjectReport.aspx -D:CCNetRequestSource=Dashboard -D:CCNetWorkingDirectory="C:\Program Files (x86)\CruiseControl.NET\server" cc]
I'm thinking that maybe there's a config setting for cruisecontrol that tells it to ignore buildargs?
I've tried reordering the lines in the nant task, putting buildargs at the top as you see, and a few places in the middle and the bottom. I've tried the different syntaxes that are available for buildargs such as:
-D:CCFoo="Unknown"
-D:CCFoo=Unknown
-DCCFoo=Unknown
I figured this out - the ccnet.config file that's used by the ccnet daemon process won't reload the build config file until either:
a) the process is restarted OR
b) the ccnet.config file is altered or touched in some way.
So I just went into C:\Program Files (x86)\CruiseControl.NET\server.ccnet.config and added a space, saved and now the buildargs are being passed to nant. woohoo!
I had the exact same problem running some bat file but my reason was I has used:
<msbuild>
...
instead of
<exec>
...

Getting MSTest output to show in CruiseControl.Net

I currently have our build server set up with CruiseControl.Net running a build using MSBuild and then running unit tests using MSTest. The problem is I can't see the output of the unit tests in CC - I know they are being run because I can get the build to fail if I commit a failing test.
I have followed the online guides from http://blogs.blackmarble.co.uk/blogs/bm-bloggers/archive/2006/06/14/5255.aspx and http://www.softwarepassion.com/?p=89 but still having no luck.
My ccnet.config file contains
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>C:\CCBuilds</workingDirectory>
<projectFile>Application.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
<targets>Build</targets>
<timeout>900</timeout>
<logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
<exec>
<executable>deleteTestLog.bat</executable>
<baseDirectory>C:\CCBuilds</baseDirectory>
<buildArgs></buildArgs>
<buildTimeoutSeconds>30</buildTimeoutSeconds>
</exec>
<exec>
<executable>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mstest.exe</executable>
<baseDirectory>C:\CCBuilds</baseDirectory>
<buildArgs>/testcontainer:UnitTests\bin\Debug\UnitTests.dll /runconfig:localtestrun.Testrunconfig /resultsfile:testResults.trx</buildArgs>
<buildTimeoutSeconds>30</buildTimeoutSeconds>
</exec>
</tasks>
<publishers>
<merge>
<files>
<file>testResults.trx</file>
</files>
</merge>
<xmllogger logDir="C:\Program Files\CruiseControl.NET\server\Checkin Build\Artifacts\buildlogs" />
</publishers>
The log file in C:\Program Files\CruiseControl.NET\server\Checkin Build\Artifacts\buildlogs contains the unit test results, have I missed any steps?
i made the following changes to get MSTest results output to be shown in CruiseControl.NET
1) For Dashboard - in dashboard.config added a reference to the Mstest 2008 xsl file under buildReportBuildPlugin
<xslFile>xsl\MsTestReport2008.xsl</xslFile>
2) For email - in ccservice.exe.config added the reference to the same xsl file under xslFiles section
<file name="xsl\MsTestSummary2008.xsl"/>
Did you configure your web dashboard with the correct xsl to format the outputs? There are two different versions of the XSL's (Summary and Report) for VSTS 2005 and 2008 as Microsoft changed the XML output drastically between the two versions. The changes were very good, just breaking changes.
For the Dashboard, I think you need to add the MSTest Summary in the xlsFiles, but add the MSTest Report build report plugin. That is,
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\MsTestSummary2008.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
<xslReportBuildPlugin description="MSTest Report" actionName="MSTESTReport" xslFileName="xsl\MsTestReport2008.xsl" />
</buildPlugins>
I tried adding MSTestReport on both but it didn't work, but the setting above did. Hope that helps...

Is there a way to force the refresh the meta model, which SubSonic builds after a DDL change in the DataBase

E.g. when I add a new table it does not appear in the Northwind namespace untill I remove the project folder from :
C:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\
or add and readd the SubSonic.dll
I have the following configuration :
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic"></section>
....
<SubSonicService defaultProvider="Northwind">
<providers>
<clear/>
<add name="Northwind"
type="SubSonic.SqlDataProvider, SubSonic"
connectionStringName="Northwind"
generatedNamespace="Northwind"/>
</providers>
</SubSonicService>
<connectionStrings>
<add name="Northwind" connectionString="Data Source=.;Database=Northwind;Integrated Security=true;"/>
</connectionStrings>
....
<compilation debug="true">
<buildProviders>
<add extension=".abp" type="SubSonic.BuildProvider, SubSonic"/>
</buildProviders>
...
<pages>
<controls>
<add assembly="SubSonic" namespace="SubSonic" tagPrefix="subsonic"/>
The issue here is that the BuildProvider doesn't "go off" unless you change the abp file in App_Code. It's a hack, but if you want it to work you need to open that file up and change it somehow by adding a space or something - then it will kick off the builder.
I'm working on some T4 templates so you don't have to do this. Also - you can use our commandline tool to generate the stuff to file for you:
http://subsonicproject.com/subcommander/using-the-command-line-tool-subcommander/
Thanks, both worked !
Either as you said to simply change the *.abp file ( added couple of spaces)
or
sonic.exe generate /config "D:\path\to\my\web.config"
P.S.
I have a D:\temp\utils folder , where I keep all the command line tools used ... and it is part of the %PATH% environmental variable ...
and it took me couple of minutes to realize that I had to copy the whole :
D:\libs\orm\SubSonic_2.1_Final_Source\src\SubSonic\bin\Debug directory to that command line tools folder ...
Edit: Even faster with VS External Tool command :
Tools - External Tools - Add
Title: SubSonic
Command: D:\path\to\sonic.exe
Arguments: generate /config "D:\path\to\my\web.config"
Initial Directory: {$ProjectDir}
Tools - Options - Keyboard
Find tools Subsonic
for it to work from anywhere on the command line

Resources