Property is not valid error caused by auto removal of quotes from MSBuild options
Symptoms
When running an MSBuild task, bamboo removes the quotes around the property value which cause the build to fail. As mentioned in a Microsoft document regarding this error: MSBuild Error MSB1006 because semicolons are used as a property separator, the remaining part after quotes are removed will be an invalid expression.
Example 1:
/t:Release /p:BuildVersion="1.0.0.${bamboo.buildNumber}"
/p:ProductsToRelease="JIRA;Bamboo;Fisheye"
If quotes are not deleted, all the three options are considered as values of the property ProductsToRelease.
Example 2:
/p:Configuration="Any CPU";Platform=x64;...
Following is the error that shows up when running the build:
MSBUILD : error MSB1006: Property is not valid.
Solution
Upgrade
This problem was fixed in Bamboo 5.8. If possible upgrade to this version or a newer one.
If an upgrade is not possible then a possible workaround is presented below:
Workaround
The possible workarounds for versions of Bamboo before version 5.8 are:
use single quotes to quote the quotes to preserver your parameters. Instead of:
/p:ProductsToRelease="JIRA;Bamboo;Fisheye"
Use:
/p:ProductsToRelease='"'JIRA;Bamboo;Fisheye'"'
Place all the options as a single line in a msbuild.rsp file in the directory that the build solution or project resides then running the MSBuild task with empty options.