1
votes

I'm trying to set-up a TFS build. I've customised the default TFS2013 workflow to obtain BuildDetail just before the MSBuild commmand. However, I now get a build error:

MSBUILD : error MSB1008: Only one project can be specified. Switch: not

For switch syntax, type "MSBuild /help"

My command line arguments are as follows:

/target:publish;/p:PublishDir=\\Server1\PublishDir\;PublishingURL=https://www.website.com

I've played about with this, as I've read several questions on here along the same lines that point to a space, quote or a slash in the wrong place.

I've also changed the MSBuild command to look like this:

String.Format("/p:SkipInvalidConfigurations=true /p:BuildNumber={1} {0}", AdvancedBuildSettings.GetValue(Of String)("MSBuildArguments", String.Empty), BuildDetail.BuildNumber)

My target is to access the BuildNumber from within the proj file.

Can anyone point me in the right direction to diagnose this?

EDIT:

Based on the answer by @sburgess123 below, using $(TF_BUILD_BUILDNUMBER) causes an exception in the build. The exception isn't massively helpful; but it's here:

Run MSBuild

Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Having looked, I can't find an actual error anywhere in the logs, but if I remove the reference to $(TF_BUILD_BUILDNUMBER) it's fine.

1

1 Answers

0
votes

You don't need to modify the build process template to do this. In 2013 there are a bunch of environment variables you have access to. See the section 'use environment variable data in msbuild' in the following link:

http://msdn.microsoft.com/en-gb/library/hh850448.aspx