a blog for those who code

Friday 10 October 2014

Solved "MSBuild : Error MSB1008: Only one project can be specified"

In this post we will show you how to fix "MSBuild : Error MSB1008: Only one project can be specified".


MSBuild can only build one project. So specify only one project to build. If you have more than one project, build them one by one.

You might also get this error if your MSBuild switches contain space or its surrounded with double quotes. So if any of the switches contain a path that has spces in it, make sure that it should end with double backward slashes.

You will also get this error if you have written something like
C:\example> msbuild example.sln \t:build
You have to change your above script to C:\example> msbuild example.sln /t:build
Whenever you get this error at first check that you have given correct slash (\ or /) or not.

Please Like and Share the Blog, if you find it interesting and helpful.


4 comments:

  1. Hi. This post was really helpful. This solved the problem which i was struggling to resolve since two days. Thank you very much Hemant Joshi.

    ReplyDelete
  2. c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /t:PipelinePreDeployCopyAllFilesToOneFolder /p:DeployOnBuild=True;_PackageTempDir="\\storage\builds\mine\";Configuration=Release;AssemblyOriginatorKeyFile=c:\prjNET\Common\Key.snk;OutputPath="c:\Development\bin" Code\Proj\Maint.csproj /property:FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"

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

    ReplyDelete
  3. you may want to try to remove the trailing '\' in your _PackageTempDir param

    ReplyDelete
  4. Hi sir
    i am getting this error past from many days plz help me ..
    i dont know where i am doing Mistakes..trying to solve it past from many days..

    C:\Program Files (x86)\Jenkins\workspace\SG-Admin-Dev>exit 0
    Path To MSBuild.exe: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
    Executing the command cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" msbuild ScoreGeniusAdmin /P:VisualStudioVersion=15.0 /p:username=Adminstrator /P:Password=ipr@1234567 /P:AllowUntrustedCertificate=true /P:DeployOnBuild=True "/P:PublishProfile=C: \Website\ScoreGeniusAdmin" /P:MsDeployServiceUrl=http://34.242.99.230:8012 /P:Configuration=Release ScoreGenius.sln " && exit %%ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\workspace\SG-Admin-Dev
    [SG-Admin-Dev] $ cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" msbuild ScoreGeniusAdmin /P:VisualStudioVersion=15.0 /p:username=Adminstrator /P:Password=ipr@1234567 /P:AllowUntrustedCertificate=true /P:DeployOnBuild=True "/P:PublishProfile=C: \Website\ScoreGeniusAdmin" /P:MsDeployServiceUrl=http://34.242.99.230:8012 /P:Configuration=Release ScoreGenius.sln " && exit %%ERRORLEVEL%%
    Active code page: 1252
    Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.

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

    For switch syntax, type "MSBuild /help"
    Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
    Finished: FAILURE

    ReplyDelete