Which version of STM32CubeMX are you using ?
On the last version (4.9), the board definition file (the XML file in your project) is not well generated. Can you open the xml file and verify that the attribute id value of the is between double quote. If not, add them.
We have reported already this bug on the generated files for SW4STM32 to ST. Hope it will be fixed soon.
Sorry for this invenience.