Overly verbose output for Teamcity MSBuild Runner - msbuild

I'm kicking of an msbuild script using the Teamcity msbuild runner.
Unfortunately, I'm finding that the build log output is too verbose, specifically each message is prepended with:
[08:52:34]: [Project "SomeScript.msbuild.teamcity.patch.tcprojx" (CleanBuildAll target(s)):]
(The script, teamcity extension, and task being run).
Is there any way to remove this message prefix?

Limitation of Teamcity, their tech support was unable to help me.
The solution is use Hudson instead of Teamcity.

Related

Teamcity 9x ignoring MsBuild parameters

I am trying to build, package and deploy a web application using Teamcity but for some reason Teamcity is ignoring the properties that I am passing to MsBuild.exe.
I have created a step in the build configuration to build, package and deploy teh application to the local server. Here are the properties:
/P:Configuration=Release
/P:DeployOnBuild=True
/P:DeployTarget=MSDeployPublish
/P:DeployIISAppPath=MyDeployedWebsitePath
/P:AllowUntrustedCertificate=True
/P:MSDeployPublishMethod=WMSvc
/P:CreatePackageOnPublish=True
/P:UserName=Administrator
/P:Password=******
/P:MsDeployServiceUrl=MyServerName
Passing them as command line parameters to MSBuild step or declaring them as System Properties in Parameters tabs doesn't seem to work. Teamcity builds the application but ignores the package and deployment steps!
If I execute MSBuild through command line on the same server (with the same params) the package and deployment works.
I am following the steps mentioned in Troy Hunt's series: https://www.troyhunt.com/you-deploying-it-wrong-teamcity_26/
I have read a lot of stack overflow questions and it seems to work seamlessly for others. I am not sure what's going wrong.
I would really appreciate any help.
Update - Build log
> Step 2/2: Build (MSBuild) (51s)
[18:32:48][Step 2/2] ##teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_18' value='0.0']
[18:32:48][Step 2/2] Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\TeamCity\buildAgent\work\b12fe165603f4f19 /msbuildPath:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
[18:32:48][Step 2/2] in directory: C:\TeamCity\buildAgent\work\b12fe165603f4f19
[18:32:56][Step 2/2] Targets were not defined in the build configuration.
[18:32:56][Step 2/2] MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead.
[18:33:02][Step 2/2] EnsembleID.Web\EnsembleID.Web.csproj.teamcity: Build target: Build (37s)
[18:33:40][Step 2/2] Process exited with code 0
It turned out to be a version issue :/
I tried different options for MSBuild version - Microsoft .Net Framework 4.5, 4.0 etc.
Finally, Microsoft Build Tools 2015 option worked.
For the past week I have been banging my head on this and I lost track of what all different permutations I tried. I had installed all the different versions of framework tools and web deployment tools, I am not sure why the other options didn't work for me. So if someone is facing a similar problem, make sure to try out different MSBuild version.

Using SonarQube with TeamCity and C# / .NET

We use TeamCity as our build server - how does one setup TeamCity to run SonarQube analysis for C# / .NET solutions?
I'm thinking we'll need to execute the MSBuild runner as a command line task since the TeamCity SonarQube runner doesn't call the MSBuild SonarQube runner.
(It would be great if http://docs.sonarqube.org/display/PLUG/C%23+Plugin described this scenario.)
EDIT
The URL in the original post has changed. Correct link is here.
You're right: There are build step/tasks for the MSBuild SonarQube Runner available out-of-the-box for Team Foundation Server 2015 (and soon Jenkins) - but not for TeamCity. You indeed need to use the command line step/task to manually invoke the MSBuild SonarQube Runner begin and end phase, and MSBuild in between.
From there, the actual configuration and usage is identical to the command line scenario, which is why the TeamCity doesn't have its own documentation.
Here is what I did to run this via a build task
Put the following command as a .cmd file in the solution root
cd %system.agent.home.dir%
C:\sonarqube\bin\MSBuild.SonarQube.Runner.exe begin /key:MyKey /name:MyProjectName /version:1
"C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" MySolution.sln /t:Rebuild
C:\sonarqube\bin\MSBuild.SonarQube.Runner.exe end
Create a "Command" task in TeamCity and execute the .cmd file

Is it possible to tell MSBuild in TeamCity to use multiple cores

Apparently the default number of cores MSBuild will use during compilation is 1.
In TeamCity I have tried adding /m:8 to the Command line parameters field in an MSBuild Runner type task to tell the MSBuild compiler to use up to 8 cores to compile the projects within the solution.
(I realise the amount it can do in parallel depends on the dependencies between the projects in the solution.)
However when I look in the build logs I don't see any mention of that parameter?
Is this the right way to do this? Does anyone know if TeamCity supports this?
Note: This is on TeamCity 8.1.5 (build 30240)
If you have access to the build agent, when the build is in progress, you could login and start task manager, to see if there are multiple msbuild.exe (s).
I don't think that the build logs will have any info about this. What kind of info are you looking for?

Is there an easy way to compare two files and error out if they are not identical?

As part of our Continuous Integration builds, I'd like the build to fail if a Visual Studio solution is using two different versions of the same dll. We are using Jenkins for CI and MSBuild.exe to build our product.
I know that this can be accomplished via C# code, but I'm trying to avoid that. I'd prefer to use something built into MSBuild or MSBuild Community Tasks or a built in command line executable like FC.exe. I've looked at FC.exe and it outputs text that says
FC: no differences encountered
and I suppose I can direct the output to a file and then parse that file, but that seems hacky at best.
Is there an elegant way to do this?
Nevermind...I just executed FC.exe within MSBuild and I noticed that it returns an error code of 1 when the files do not match. Problem solved!
You could invoke powershell via MSBuild (I think the community tasks have a cmdlet execution task) and leverage the Compare-Object cmdlet.
http://technet.microsoft.com/en-us/library/ee156812.aspx
Jenkins has a PowerShell module as well that you could use.

MStests through TeamCity

How do you run MStests through TeamCity and the MSBUILD option? Do you put these settings in the main solution?
Thanks
It is possible to configure sln2008 runner to start mstest for you.
Another way is to write custom msbuild script that first calls and than call mstest.exe process. To report generated .trx file please use TeamCity Service Message:
##teamcity[importData type='mstest' path='']