System.Configuration for MSBuild
Hi all,
I could do with a little bit of advice if possible.
In our typical TeamCity Projects for .NET applications we tend to have two configurations:
- Visual Studio Build -> which runs a build of the entire solution thus ensuring that all .NET projects within the solution compile. At this stage we also restore Nuget packages, Run NUnit unit tests and dotCover. We always set this to use the Target of "Rebuild" and the Configuration "Release".
- MSBuild -> which compiles the necessary projects, runs Octopack and pushes the Nuget packages to our Octopus Deploy server.
My first question is, we've followed this pattern for a couple of years without questioning whether it's the best approach, or even whether it's a common approach?. We took this approach after reading Troy Hunt's articles at https://www.troyhunt.com/you-deploying-it-wrong-teamcity_26/.
My second question is regarding System Parameters. I remember a year or two back when we were providing command line parameters /p for MsBuild, TeamCity warned that we should be using System Parameters instead. The particular parameter I am intested in is Configuration, which previously I specified in the Command Line parameters as /p:Configuration=Release. I have since moved this to a System Parameter, System.Configuration - however, if I look at the build log there is no mention of the Release configuration being used. Is it correct to assume that whilst it' not showing in the build log, TeamCity is in fact passing the Configuration parameter into MSBuild when it executes it? On this documentation page, right at the bottom is states: When using MSBuild, replace "." with "_" when you reference property names, so I'm wondering whether it should in-fact be System_Configuration??
Any advice and/or feedback would be greatly appreciated.
Many thanks
Al
Please sign in to leave a comment.
Hello Alastair,
Could you please explain if your MSBuild and Visual Studio Build configurations are using the same .*csproj/*.sln files from the same VCS root?
Could you please attach your build logs?
Hi Marina,
Yes - the Visual Studio build is using the .sln and the MSBuild build is using the .csproj file from the same VCS Root.
Do you need any other information?
Regards,
Al
Hello Alastair,
Your setup is ok, however both configurations seem to be doing almost the same job.
The parameter is not displayed in build log since it is passed via a file with all the MSBuild command line parameters - you can find it in buildtemp folder on Agent while the step is running.
Hi Marina,
I realise that they seem to do almost the same job, however the .csproj doesnt have references to all of the other projects within the solution (they are used for other services), so the Visual Studio configuration ensures that the entire solution builds (and in our case runs unit tests etc), whereas the MSBuild configuration just deals with building the requirements for that one project (and it's dependencies) and packaging into nuget files etc.
If it's normal that I don't see the Configuration parameter being passed to MSBuild that's absolutely fine - that was the main point. Thank you for your response and time.
Kind regards,
Al