Error Parsing Command from Build Command Line Task for SSIS Project

The build Command Line task available in the Task Gallery provides the Tool and Arguments options for configuration. The Tool option is where you specify the executable to run and the Arguments option are the values to be passed into the executable.

Worked with a customer on a support case where they were trying to execute an SSIS build using the Command Task with the following argument: $(Build.SourcesDirectory)\SSISTest\SSISTest.sln /rebuild $(BuildConfiguration) /project $(Build.SourcesDirectory)\SSISTest\SSISTest\SSISTest.dtproj /out "c:\temp\output.txt"

On each build, the following error message is logged in the output.txt:

The following files were specified on the command line:

C:\Visual  Studio  Build  Agent 2\_work\1\s\SSISTest\SSISTest.sln

These files could not be found and will not be loaded

We extracted the full command from the build log files and executed directly from the command prompt. This would successfully create the build and removed Visual Studio as the culprit. The next action was to move the build agent from the  C:\Visual  Studio  Build  Agent 2 folder to a folder without spaces, such as C:\Builds. This seemed to resolve the issue.

I spoke with the TFS build team they suggested to enclose both commands in the Argument option in quotes. The command parser would treat each parameters as a single entity and spaces in the agent's folder name would not  impact the overall the parsing of the parameters. This resolved the issue with the build agent running in a folder with spaces and would provide a better option for the command.

Original Command (Did not work): $(Build.SourcesDirectory)\SSISTest\SSISTest.sln /rebuild $(BuildConfiguration) /project $(Build.SourcesDirectory)\SSISTest\SSISTest\SSISTest.dtproj /out "c:\temp\output.txt"

Modified Command (works): "$(Build.SourcesDirectory)\SSISTest\SSISTest.sln" /rebuild "$(BuildConfiguration) /project $(Build.SourcesDirectory)\SSISTest\SSISTest\SSISTest.dtproj" /out "c:\temp\output.txt"