MSBUILD : error MSB1008: Only one project can be specified

136,888

Solution 1

SOLUTION
Remove the Quotes around the /p:PublishDir setting

i.e.
Instead of quotes

/p:PublishDir="\\BSIIS3\c$\DATA\WEBSITES\benesys.net\benesys.net\TotalEducationTest\"  

Use no quotes

/p:PublishDir=\\BSIIS3\c$\DATA\WEBSITES\benesys.net\benesys.net\TotalEducationTest\  

I am sorry I did not post my finding sooner. I actually had to research again to see what needed to be changed. Who would have thought removing quotes would have worked? I discovered this when viewing a coworkers build for another solution and noticed it did not have quotes.

Solution 2

It turns out the trailing slash in the PublishDir property is escaping the end quote. Escaping the trailing slash solved my problem.

/p:PublishDir="\\BSIIS3\c$\DATA\WEBSITES\benesys.net\benesys.net\TotalEducationTest\\"

This way we can use quotes for paths that have whitespace in properties that MSBuild requires the trailing slash.

I know this is an old post, but I feel like I needed to share this with someone :-)

Solution 3

On Git Bash I had to specify the parameters with double slashes like:

MSBuild.exe "Path\to\Solution.sln" //p:Platform="x86" //p:Configuration=Release //p:AppxBundlePlatforms="x86" 

Solution 4

This problem appears when you have a path or a property containing a space and that is not quoted.

All your properties and path have quote around them, it's strange. The error message indicates Education as a switch, try to remove /p:ProductName="Total Education TEST" to see if it works.

Solution 5

You need to put qoutes around the path and file name.
So use MSBuild "C:\Path Name\File Name.Exe" /[Options]

Share:
136,888
craphunter
Author by

craphunter

Solutions Architect at BeneSys, Inc LinkedIn | Twitter @GerhardWeiss Secretary at Great Lakes Area .NET Users Group (GANG) GANG LinkedIn Group | Meetings | Twitter @gangannounce I am a VB.NET and PL/B solutions and software architect, application designer, team leader, and senior programmer/analyst with 25 years of solid experience in all phases of software application development. I have had team leadership, project management, and mentoring responsibilities throughout the software development lifecycle. My experience has also included requirements gathering, analysis, database design, technical writing, testing, and deploying applications.

Updated on July 08, 2022

Comments

  • craphunter
    craphunter almost 2 years

    Why am I getting the following Build error?

    C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe C:\Code\EduBenesysNET\EduBenesysNET\EduBenesysNET.vbproj /t:publish /p:Configuration=Release /p:Platform=AnyCPU /v:detailed /p:PublishDir="\\BSIIS3\c$\DATA\WEBSITES\benesys.net\benesys.net\TotalEducationTest\"  /p:InstallUrl="https://www.benesys.net/benesys.net/TotalEducationTest/"  /p:ApplicationVersion=1.0.1.198  /p:ProductName="Total Education TEST"   /p:PublisherName="BeneSys, Inc."  /p:UpdateRequired="True"  /p:MinimumRequiredVersion=1.0.1.198
    Microsoft (R) Build Engine Version 3.5.30729.1
    [Microsoft .NET Framework, Version 2.0.50727.3603]
    Copyright (C) Microsoft Corporation 2007. All rights reserved.
    
    MSBUILD : error MSB1008: Only one project can be specified.
    Switch: Education
    
    For switch syntax, type "MSBuild /help"
    

    I do not see how a second project is being specified.
    Is it stored in a project file somewhere?

    • Cédric Rup
      Cédric Rup over 13 years
      The very same command works in powershell but not in cmd.exe... looks like you are hitting a spacial character sequance somewhere...
  • user3103701
    user3103701 almost 13 years
    This is very strange. In my case I got the same error but the problem is that I had an unquoted path with a space in it. Adding the quotes fixed the problem.
  • Gopinath
    Gopinath over 11 years
    Avoid Space in folder path to get rid of this issue.
  • Zitrax
    Zitrax over 11 years
    I had the same issue as @MarkArnott, it did not work with spaces or escaped spaces, but quoting did.
  • Carl G
    Carl G over 10 years
    Probably the last backslash in your path was escaping the closing double-quote. If correct, then you didn't need to remove the double-quotes, but instead you needed to escape your backslashes.
  • theMayer
    theMayer over 9 years
    This answer could use some tidying up. Very difficult to follow.
  • Valentein
    Valentein over 9 years
    The point about Never using spaced in your TFS Build Definition names is a good one! This has caught me multiple times.
  • Nevin Raj Victor
    Nevin Raj Victor almost 9 years
    @Julien Hoarau: I tried MSBuild.exe C:\BuildAgent\work\4c7b8ac8bc7d723e\WebService.sln /p:Configuration=Release /p:OutputPath=bin /p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:MsDeployServiceUrl=https://204.158.674.5/msdeploy.axd /p:username=Admin /p:password=Password#321 /p:AllowUntrustedCertificate=True /p:DeployIisAppPath=Default WebSite/New /p:MSDeployPublishMethod=WMSVC. It gives me an error MSBUILD : error MSB1008: Only one project can be specified. Switch: WebSite/New. What might be the issue?
  • OK999
    OK999 almost 8 years
    Remember, the spaces in dir path needs to be escaped or have to be placed inside a double quotes
  • habib
    habib over 4 years
    I was also missing closing double quotes.
  • Anderson Pimentel
    Anderson Pimentel about 4 years
    @NevinRajVictor A lot late, but probably you should put quotes around Default WebSite/New
  • Wolfium
    Wolfium over 3 years
    Look like this is the root cause, related on how Git_Bash works on POSIX path starting with a slash putting in the mix the windows style paths Double slashes solve or you can disable automatic path conversion to keep interoperability history: mingw.org/wiki/Posix_path_conversion Release notes github.com/git-for-windows/build-extra/blob/…
  • parched
    parched about 2 years
    Alternatively, you can use -p instead of /p.