I have some .NET Framework projects being built by TeamCity 2020 (latest version). Currently the "MSBuild" Runner type is used - as this is deprecated, I'm trying to convert the build tasks to use the new ".NET" Runner type. When trying to set the Platform
property to "Any CPU" in the parameters, TeamCity ends up quoting the entire parameter and this causes MSBuild to fail.
I'm setting the following properties for this runner:
msbuild
MSBuild 2019
%BuildConfiguration%
(parameter value)-property:Platform="Any CPU" -verbosity:minimal -nodeReuse:false
When this build runs, it fails. In the log you can see the MSBuild command being run:
MSBuild.exe [solution file] /p:Configuration=[config parameter] "-property:Platform="Any CPU"" -verbosity:minimal -nodeReuse:false
Because TeamCity is putting double-quotes around the -property:Platform
parameter, MSBuild doesn't recognise this and thinks that multiple project files are being supplied, so it exits.
I've tried using single quotes for 'Any CPU', removing the space, using the /p:Platform
syntax... same result.
How do I use the .NET Runner to build .NET Framework projects for the "Any CPU" platform?
The solution that eventually worked for me was to create a new Solution Platform which was based on the existing "Any CPU"
one but instead called AnyCpu
. Now there's no spaces or quotes to confuse things.