-1

I am trying to set up a command line build (currently using TFS build & moving to Jenkins based build). MsBuild's OutDir parameter does not seem take %MainPath% argument correctly.

set MainPath="C:\Users\jayapraa\Documents\Visual Studio 2017\Projects\" 
set MSBuildPath="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\"

cd %MSBuildPath%

msbuild.exe "C:\Users\jayapraa\Documents\Visual Studio 2017\Projects\WindowsFormsApp1\WindowsFormsApp1.sln" /t:Build /p:OutDir=%MainPath%;Configuration=Release;Platform=x64;TargetFrameworkVersion=v4.7.1

image of error

1201ProgramAlarm
  • 32,384
  • 7
  • 42
  • 56
jayanand
  • 47
  • 9
  • Why are you using the old msbuild in .net framework? use the version in 2017 (msbuild/bin subfolder of VS installation) – Martin Ullrich Nov 28 '17 at 08:39
  • Same issue with the MSBuild version 15.0. – jayanand Nov 28 '17 at 15:36
  • I'm not positive, but I believe you can separate the `/p:` values. I would try to decompose them into separate switches (especially the one that is generating an error) to see if it helps. – Phil Brubaker Nov 28 '17 at 16:40
  • I began with passing different /p args. It was not working. Then I took this syntax from another stackoverflow post. It worked for hardcoded paths. – jayanand Nov 30 '17 at 18:44
  • set "baseName=C:\Output\Full Build\Full Build-%Year%%Month%%Day%-" - setting the variable within quotes made it work.. – jayanand Dec 12 '17 at 19:33

1 Answers1

0

set "baseName=C:\Output\Full Build\Full Build-%Year%%Month%%Day%-" - setting the variable within quotes made it work..

MSBuild.exe "Mtell.Reservoir.sln" /t:Rebuild /p:OutDir="%baseName%%n%";

jayanand
  • 47
  • 9