Msbuild error msb1008 only one project can be specified

 locked

MSBUILD : error MSB1008: Only one project can be specified. Switch: FilesMicrosoft For switch syntax, type «MSBuild /help»

RRS feed

  • Question

  • MSBUILD : error MSB1008: Only one project can be specified. Switch: FilesMicrosoft For switch syntax, type «MSBuild /help»

Answers

  • The error usually comes because of the space in arguments. Try to add the double quotes to path of solution and then
    try again.

    • Marked as answer by
      John QiaoModerator
      Friday, January 21, 2011 4:28 AM

All replies

  • The error usually comes because of the space in arguments. Try to add the double quotes to path of solution and then
    try again.

    • Marked as answer by
      John QiaoModerator
      Friday, January 21, 2011 4:28 AM

  • Hi Muhammad,

    Thanks for your post.

    As Jehan said that the space is interpreted as multiple projects, you should to add the “ character around the sln file, like this: msbuild.exe “c:……project1.sln”.

    Has this issue been resolved?


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • I am having the same problem.  I’ve got this to work but sometimes it doesn’t.  What am I doing wrong ?

    msbuild «C:developSEIExplorerSQExplorerSEIExplorer_2005.csproj» /target:publish p:InstallUrl=\sv-qnap1.seismicventures.comdataseiexplorer /p:PublishDir=\sv-qnap1.seismicventures.comdataseiexplorer /p:ApplicationRevision=1 /p:Application=300* /p:PublisherName=»SEI»
    /p:ProductName=»Seismic Explorer»

    I’m really desperate to get this working as I have to deliver my app to two distinct servers and the versions need to be consistent with one another but the installs seperate.

    thanks,

    kyle

    • Proposed as answer by
      Riccardo Ballarino
      Thursday, August 28, 2014 10:18 AM

  • In vs2012 just try to create a Build definition «Test Build» using the default TFS template  «DefaultTemplate….xaml» (usually a copy of it)
    It will fail with the usual self-explaining-error : «MSBUILD : error MSB1008: Only one project can be specified.Switch: Activities»
    Off course somewhere in the default TFS template some » are missing so msbuild will receive as parameter a non escaped directory containing spaces so will result in multiple projects(?!)
    So NEVER use spaces in you TFS  Build Definition names, pretty sad and simple at the same time

Oddly unable to update my two project razor solution (Test->Website). I’m getting an odd MSBUILD error which usually means there’s a path/trailing slash issue?

111→ C:githubhanselminutes-corehanselminutes.core [main ≡ +1 ~0 -0 !]> nukeeper mode=update dir="c:/github/hanselmin
utes-core/hanselminutes.core/"
Using 'update' for 'mode'
Using 'https://api.github.com' for 'github_api_endpoint'
Using '3' for 'max_pull_requests_per_repository'
Using '10' for 'max_repositories_changed'
Using 'Info' for 'log_level'
Using 'Major' for 'allowed_version_change'
Using '7d' for 'min_package_age'
Using 'PreferFork' for 'fork_mode'
Using 'Off' for 'report_mode'
Using 'nukeeper' for 'github_labels'
Using 'c:/github/hanselminutes-core/hanselminutes.core/' for 'dir'
Running NuKeeper in update mode
Found 8 packages in use, 8 distinct, in 1 projects.
BuildBundlerMinifier, LazyCache, LazyCache.AspNetCore, Markdig, Microsoft.ApplicationInsights.AspNetCore, Microsoft.AspNetCore.App, Microsoft.Extensions.Http.Polly, Microsoft.NET.Test.Sdk
Found 6 possible updates
BuildBundlerMinifier from 2.7.385 to 2.8.391 in hanselminutes-core.csproj
Markdig from 0.15.0 to 0.15.1 in hanselminutes-core.csproj
Microsoft.ApplicationInsights.AspNetCore from 2.3.0-beta2 to 2.3.0 in hanselminutes-core.csproj
Microsoft.NET.Test.Sdk from 15.7.0 to 15.7.2 in hanselminutes-core.csproj
Microsoft.Extensions.Http.Polly from 2.1.0 to 2.1.1 in hanselminutes-core.csproj
Microsoft.AspNetCore.App from 2.1.0 to 2.1.2 in hanselminutes-core.csproj

Selection of package updates: 6 candiates, filtered to 4, capped at 3
Updating Microsoft.ApplicationInsights.AspNetCore to 2.3.0 from 2.3.0-beta2 in 1 place since 2 months ago.

Unhandled Exception: System.Exception: Exit code: 1

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

For switch syntax, type "MSBuild /help"



   at NuKeeper.Update.ProcessRunner.ExternalProcess.Run(String workingDirectory, String command, String arguments, Boolean ensureSuccess) in C:CodeNuKeeperNuKeeper.UpdateProcessRunnerExternalProcess.cs:line 46
   at NuKeeper.Update.Process.DotNetUpdatePackageCommand.Invoke(PackageInProject currentPackage, NuGetVersion newVersion, PackageSource packageSource, NuGetSources allSources) in C:CodeNuKeeperNuKeeper.UpdateProcessDotNetUpdatePackageCommand.cs:line 34
   at NuKeeper.Update.UpdateRunner.Update(PackageUpdateSet updateSet, NuGetSources sources) in C:CodeNuKeeperNuKeeper.UpdateUpdateRunner.cs:line 27
   at NuKeeper.Local.LocalUpdater.ApplyAnUpdate(IReadOnlyCollection`1 updates, NuGetSources sources) in C:CodeNuKeeperNuKeeperLocalLocalUpdater.cs:line 52
   at NuKeeper.Local.LocalEngine.Run(SettingsContainer settings) in C:CodeNuKeeperNuKeeperLocalLocalEngine.cs:line 54
   at NuKeeper.Program.Main(String[] args) in C:CodeNuKeeperNuKeeperProgram.cs:line 28
   at NuKeeper.Program.<Main>(String[] args)

Why am I getting the following Build error?

C:WINDOWSMicrosoft.NETFrameworkv3.5msbuild.exe C:CodeEduBenesysNETEduBenesysNETEduBenesysNET.vbproj /t:publish /p:Configuration=Release /p:Platform=AnyCPU /v:detailed /p:PublishDir="\BSIIS3c$DATAWEBSITESbenesys.netbenesys.netTotalEducationTest"  /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?

19 Answers

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

/p:PublishDir="\BSIIS3c$DATAWEBSITESbenesys.netbenesys.netTotalEducationTest\"

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
Remove the Quotes around the /p:PublishDir setting

i.e.
Instead of quotes

/p:PublishDir="\BSIIS3c$DATAWEBSITESbenesys.netbenesys.netTotalEducationTest"  

Use no quotes

/p:PublishDir=\BSIIS3c$DATAWEBSITESbenesys.netbenesys.netTotalEducationTest  

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.

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

MSBuild.exe "PathtoSolution.sln" //p:Platform="x86" //p:Configuration=Release //p:AppxBundlePlatforms="x86" 

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.

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

Try to remove the trailing backslash or slash at the end of you publish path and install url

/p:PublishDir="\BSIIS3c$DATAWEBSITESbenesys.netbenesys.netTotalEducationTest"
/p:InstallUrl="https://www.benesys.net/benesys.net/TotalEducationTest"

You must have hit a special sequence of characters with the » and (or) /», but I don’t know enough in cmd.exe to figure out.

I personnaly always use Powershell : it’s way more friendly and powerful!

Hope it helps!

In vs2012 just try to create a Build definition «Test Build» using the default TFS template «DefaultTemplate….xaml» (usually a copy of it)

It will fail with the usual self-explaining-error: «MSBUILD : error MSB1008: Only one project can be specified.Switch: Activities»

Off course somewhere in the default TFS template some " are missing so msbuild will receive as parameter a non escaped directory containing spaces so will result in multiple projects(?!)

So NEVER use spaces in you TFS Build Definition names, pretty sad and simple at the same time

I was using single quotes around the password parameter when I got the error

/p:password='my secret' bad

and changed it to use double quotes to resolve the issue.

/p:password="my secret" good

Likely the same would apply to any parameter that needs quotes for values that contain a space.

For me I had forgot to add closing quote

/p:DeployOnBuild=true;OutDir="$(build.artifactstagingdirectory)

to

/p:DeployOnBuild=true;OutDir="$(build.artifactstagingdirectory)"

Yet another cause and solution to this: Check that you didn’t put a space in the wrong place, i.e. in parameters; mine was dotnet -c Release - o /home/some/path (note the space between - and o), I kept looking at the path itself, which was correct and threw me off. Hope that helps! (this was in Bash though it should also apply to Windows)

This worked for me in TFS MSBuild Argument. Note the number of slashes.

/p:DefaultPackageOutputDir=»\RdevnetVisual Studio ProjectsInsurance»

If you use default workspace in Jenkins, this might occur.
Use custom workspace location without any spaces.

enter image description here

For future readers.

I got this error because my specified LOG file had a space in it:

BEFORE:

/l:FileLogger,Microsoft.Build.Engine;logfile=c:Folder With SpacesMy_Log.log

AFTER: (which resolved it)

/l:FileLogger,Microsoft.Build.Engine;logfile="c:Folder With SpacesMy_Log.log"

If you are using Azure DevOps MSBuild task the error may be caused by doubled configuration flag. Please make sure you put $(BuildConfiguration) in specified box instead of MSBuild Arguments one:
enter image description here

If you are using Any CPU you may need to put it in single quotes.

Certainly when running in a Dockerfile, I had to use single quotes:

# Fails. Gives: MSBUILD : error MSB1008: Only one project can be specified.
RUN msbuild ConsoleAppFw451.sln /p:Configuration=Debug /p:Platform="Any CPU" 

# Passes. Gives: Successfully built 40163c3e0121
RUN msbuild ConsoleAppFw451.sln /p:Configuration=Debug /p:Platform='Any CPU' 

Just in case someone has the same issue as me, I was missing «/» before one of the «/p» arguments. Not very clear from the description. I hope this helps someone.

For me adding the path to the solution file in double quotes solved the issue. One of the folders in the path had a blank space in the name and this caused it to consider 2 solution files instead of one.
I executed in the following was and it worked.

MSBuild.exe "C:Folder Name With SpaceProjectproject.sln"

I ran into this issue with a very simple command, which didn’t include any quote, any space, any slash, anything strange at all.

I was using MINGW64 shell.

The same exact command from PowerShell worked instead.

Понравилась статья? Поделить с друзьями:
  • Msbuild error msb1001 unknown switch
  • Msb3644 как исправить
  • Msasn1 dll ошибка
  • Mssql raise error
  • Msado15 dll как исправить ошибку