configuration property in msbuild

1,994 views
Skip to first unread message

Matthieu GD

unread,
Sep 26, 2009, 6:27:09 PM9/26/09
to psake-users
Hello,

If I use this cmd line to build, it 's working :
exec msbuild "/p:OutDir=""$releasedir "" $solutionfile"

but theses failed :

exec msbuild "/p:Configuration=Release /p:OutDir=""$releasedir ""
$solutionfile"
=> error MSB4023: Cannot evaluate the item meta data "%(FullPath)".
The item meta-data "%(FullPath)" cannot be applied to the path "obj
\Release /p:OutDir=C:\Release\\XXX.Web.dll". The given path's format
is not supported.

exec msbuild "/p:Configuration=""Release "" /p:OutDir=""$releasedir ""
$solutionfile"
=> error MSB1008: Only one project can be specified.

exec msbuild "/p:Configuration=Release;OutDir=""$releasedir ""
$solutionfile"
=> error MSB4115: The "HasTrailingSlash" function only accepts a
scalar value, but its argument "$(IntermediateOutputPath)" evaluates
to "obj\Release;OutDir=C:\Release
\\" which is not a scalar value.

It seems to be an issue about passing arguments to msbuild exec but
can't figured the right way :(

Matthieu

Shaun Becker

unread,
Sep 26, 2009, 8:23:35 PM9/26/09
to psake...@googlegroups.com
Try escaping the quotes with back ticks

exec msbuild "/p:Configuration=`"Release`" /p:OutDir=`"$releasedir`" $solutionfile"

Thanks,
Shaun

Matthieu GD

unread,
Sep 26, 2009, 9:01:25 PM9/26/09
to psake-users
Thanks Shaun for your help but I got the same error with the back
ticks escaping. It seems that the porblem is occuring with other
external cmd line tools like Packer
http://svn.offwhite.net/trac/SmallSharpTools.Packer/wiki
> > Matthieu- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -

Matthieu GD

unread,
Sep 26, 2009, 9:04:07 PM9/26/09
to psake-users
if I used the powershell syntax (i.e. not the psake function), it
works :

& "msbuild" /p:Configuration=Release /p:OutDir=$releasedir
$solutionfile

On 26 sep, 21:01, Matthieu GD <matthie...@gmail.com> wrote:
> Thanks Shaun for your help but I got the same error with the back
> ticks escaping. It seems that the porblem is occuring with other
> external cmd line tools like Packerhttp://svn.offwhite.net/trac/SmallSharpTools.Packer/wiki
> > - Afficher le texte des messages précédents -- Masquer le texte des messages précédents -

Shaun Becker

unread,
Sep 27, 2009, 8:31:50 AM9/27/09
to psake...@googlegroups.com
The other thing to try is separating the parameters out:

>> exec msbuild "/p:Configuration=`"Release`"",
>> "/p:OutDir=`"$releasedir`"", "$solutionfile"

stuartg

unread,
Oct 19, 2009, 9:42:27 AM10/19/09
to psake-users
The following seems to work just fine for me:

Task Debug -depends Init {
msbuild $sln_file "/p:Configuration=Debug" "/p:OutDir=""$debug_dir"""
}

where:
$debug_dir = "$base_dir\bin\Debug\\"

Note the two backslashes

stuartg

unread,
Oct 19, 2009, 9:42:45 AM10/19/09
to psake-users
The following seems to work just fine for me:

Task Debug -depends Init {
msbuild $sln_file "/p:Configuration=Debug" "/p:OutDir=""$debug_dir"""
}

where:
$debug_dir = "$base_dir\bin\Debug\\"

Note the two backslashes

On Sep 26, 11:27 pm, Matthieu GD <matthie...@gmail.com> wrote:

stuartg

unread,
Oct 20, 2009, 6:37:21 AM10/20/09
to psake-users
Additionally after some further fiddling, I believe that msbuild
doesn't like spaces in it's switches

For example this will fail:

msbuild $sln_file "/nologo /t:Rebuild" "/p:Configuration=Release" "/
p:OutDir=""$release_dir"""

MSBUILD : error MSB1001: Unknown switch.
Switch: /nologo /t:Rebuild

Whereas this will not:
msbuild $sln_file "/nologo" "/t:Rebuild" "/p:Configuration=Release" "/
p:OutDir=""$release_dir"""

A bit of a weird one, but it seems to work just fine for me now.
Reply all
Reply to author
Forward
0 new messages