When you work with paths/commands that contains spaces, you need to quote the path first, this will work for you:
test.proj
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build">
<Message Text="Hello World! $(ABC)" Importance="high"/>
</Target>
</Project>
build.sh
#!/bin/bash
MSBUILDPATH=c:/Program\ Files\ \(x86\)/MSBuild/14.0/Bin/msbuild.exe
"$MSBUILDPATH" test.proj //t:build //p:ABC=123
or (With backslashes insted)
#!/bin/bash
MSBUILD=c\:\\Program\ Files\ \(x86\)\\MSBuild\\14.0\\Bin\\msbuild.exe
"$MSBUILD" test.proj //t:build //p:ABC=123
I'm passing the target (/t:) and property (/p:) without problems just use double slashes for them. Also note the colon (:) after the drive letter.
If you need to pass a property that contains spaces just do this:
"$MSBUILD" test.proj //t:build //p:ABC="123 456 789"
You can define your paths first and then use them in quotes to execute the command.
You can copy paste this exaple and it will work for you.