How to resolve "Only one project can be specified" error from <msbuild> task in CruiseControl.NET
Asked Answered
S

4

7

I'm trying to use the task in CruiseControl.NET version 1.3.0.2918 with a rather straight forward :

  <project name="AppBuilder 1.0 (Debug)">
    <workingDirectory>c:\depot\AppBuilder\1.0\</workingDirectory>
    <triggers/>
    <tasks>
      <msbuild/>
    </tasks>
   </project>

However, when the project is run it fails with this information in the build log:

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

For switch syntax, type "MSBuild /help"

When I look at the ccnet.log file I find this:

Starting process [C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe] in working directory [c:\depot\AppBuilder\1.0] with arguments [/nologo "/p:CCNetArtifactDirectory=C:\Program Files\CruiseControl.NET\server\AppBuilder 1.0 (Debug)\Artifacts;CCNetBuildCondition=ForceBuild;CCNetBuildDate=2009-01-22;CCNetBuildTime=09:25:55;CCNetIntegrationStatus=Unknown;CCNetLabel=3; CCNetLastIntegrationStatus=Failure;CCNetNumericLabel=3;CCNetProject=AppBuilder 1.0 (Debug);CCNetProjectUrl=http://CISERVER01/ccnet;CCNetRequestSource=jstong; CCNetWorkingDirectory=c:\depot\AppBuilder\1.0\" "/l:ThoughtWorks.CruiseControl.MsBuild.XmlLogger,ThoughtWorks.CruiseControl.MsBuild.dll;C:\Program Files\CruiseControl.NET\server\AppBuilder 1.0 (Debug)\Artifacts\msbuild-results.xml"]

from which I infer that msbuild was run in the correct working directory and that the command line passed to it was:

/nologo "/p:CCNetArtifactDirectory=C:\Program Files\CruiseControl.NET\server\AppBuilder 1.0 (Debug)\Artifacts;CCNetBuildCondition=ForceBuild;CCNetBuildDate=2009-01-22;CCNetBuildTime=09:25:55;CCNetIntegrationStatus=Unknown;CCNetLabel=3; CCNetLastIntegrationStatus=Failure;CCNetNumericLabel=3;CCNetProject=AppBuilder 1.0 (Debug);CCNetProjectUrl=http://CISERVER01/ccnet;CCNetRequestSource=jstong; CCNetWorkingDirectory=c:\depot\AppBuilder\1.0\" "/l:ThoughtWorks.CruiseControl.MsBuild.XmlLogger,ThoughtWorks.CruiseControl.MsBuild.dll;C:\Program Files\CruiseControl.NET\server\AppBuilder 1.0 (Debug)\Artifacts\msbuild-results.xml"

If I run this manually at the command line I get a similiar error.

It appears to me that the isn't passing the correct command line to the MSBuild executable.

Can you spot my error? Or is this version of CruiseControl.NET (1.3.0.2918) broken with respect to the task?

Sonstrom answered 22/1, 2009 at 14:28 Comment(1)
Without seeing your actual MSBuild task block, it will be impossible to diagnose.Cockneyfy
C
29

I think maybe it is your space in the artifact directory path. MSBuild really does not like spaces as it considers it a break between arguments. Can you try an remove the space from that path and see what happens?

Cockneyfy answered 22/1, 2009 at 20:22 Comment(6)
Alex, you're definitely onto something here. It seems its the last part of the parameter list ("/l: ....") that is confusing MSBuild. I've always just let cc.net choose the artifacts directory. I presume this is some configuration property?Sonstrom
Answering my own in-comment question here -- it appears that <artifactDirectory> in <project> can be used to control this.Sonstrom
The issue seemed to be not only spaces in the artifact directory path but spaces in the path to the logger. Once I eliminated those things seem to work. I'm going to up vote this answer and mark it as the accepted answer -- thanks for your help.Sonstrom
MSBuild definitely doesn't like spaces at all. I encountered the same error you did when testing property overrides for certain targets in my build file. Once I eliminated spaces from the paths, everything worked.Lands
Yea. Id love to eliminate the space in 'Program Files' which is currently causing me headaches, unfortunatelly a bit of a hassle. This is frustrating :(Bushido
I love the development ecosystem Microsoft has setup for us, however they really do some dumb things. Like putting spaces in a whole bunch of essential paths, and then making sure none of their tools like having spaces in the paths. Another one, is pushing everyone 64 bit, 64 bit, 64 bit and then not having their own tooling working without issues in a 64 bit environment. There is nothing more frustrating than getting a new 2008 R2 build server and have to edit every build definition (in Team Build) to use the x86 compatible MSBuild.Cockneyfy
S
3

Why is your msbuild tag empty? It should be something similar to:

<msbuild>
  <executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable>
  <workingDirectory>C:\dev\ccnet</workingDirectory>
  <projectFile>CCNet.sln</projectFile>
  <buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
  <targets>Build;Test</targets>
  <timeout>900</timeout>
  <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
Spheroid answered 22/1, 2009 at 14:34 Comment(1)
I stripped it down for simplicity in the question -- even when I had a tag as you illustrated I got the same error message.Sonstrom
C
1

Without more detail since you don't appear to be specifying a project/solution file which leaves MSBuild assuming one. If you have more than one file that MSBuild is able to use as a project file in that directory that might be causing your issue.DO you have an MSbuild .proj and a .sln file by any chance? Or two solution files?

Cockneyfy answered 22/1, 2009 at 19:7 Comment(1)
There's only a single .sln in the directory specified by <workingDirectory>. If I open a cmd window and run MSBuild with no parameters it builds without error. Only when I add all those extra parameters that cc.net adds does it fail.Sonstrom
M
1

I had a similar problem and (what Alex said) removing my space did fix the problem. I did however run into another situation where removing the space from a name was not possible. In this case, adding quotes around the name fixed the problem for me.

Martyr answered 16/10, 2013 at 18:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.