0
votes

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
1
What does the msbuild command line look like in the TeamCity build log?stijn
Updated the question with part of the build log. It just shows me the path of the MsBuild executable.Amanvir Mundra
Yeah sorry I forgot the TC log isn't really helpful - I was thinking it would maybe show properties uses, and if so you could figure out if they are passed properly (which would mean there's something wrong in the build itself) or whether they are not passed properly (which would mean TC overrided them or doesn't pass them at all). Maybe edit the project file to include things like <Message Text="DeployOnBuild=$(DeployOnBuild)"/> to figure out if the properties even make it to the build? If you change Configuration to Debug, does it effectively build Debug?stijn
Changing the configuration to Debug does build it in Debug mode.Amanvir Mundra

1 Answers

0
votes

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.