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?
This question is related to
visual-studio
visual-studio-2008
msbuild
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 :-)
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"
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
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.
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.
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 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 Spaces\My_Log.log
AFTER: (which resolved it)
/l:FileLogger,Microsoft.Build.Engine;logfile="c:\Folder With Spaces\My_Log.log"
For me I had forgot to add closing quote
/p:DeployOnBuild=true;OutDir="$(build.artifactstagingdirectory)
to
/p:DeployOnBuild=true;OutDir="$(build.artifactstagingdirectory)"
This worked for me in TFS MSBuild Argument. Note the number of slashes.
/p:DefaultPackageOutputDir="\\Rdevnet\Visual Studio Projects\Insurance\"
Try to remove the trailing backslash or slash at the end of you publish path and install url
/p:PublishDir="\\BSIIS3\c$\DATA\WEBSITES\benesys.net\benesys.net\TotalEducationTest"
/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!
I did use solution given in https://www.codingdefined.com/2014/10/solved-msbuild-error-msb1008-only-one.html and that solves the issue. All we need to do is check spaces and ''(check backslashes) in the command
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)
You need to put qoutes around the path and file name.
So use
MSBuild "C:\Path Name\File Name.Exe" /[Options]
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'
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 Space\Project\project.sln"
Source: Stackoverflow.com