MSBUILD : error MSB1008: Only one project can be specified

前端 未结 18 814
眼角桃花
眼角桃花 2021-01-30 09:39

Why am I getting the following Build error?

C:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\msbuild.exe C:\\Code\\EduBenesysNET\\EduBenesysNET\\EduBenesysNET.vbproj /t:pu         


        
相关标签:
18条回答
  • 2021-01-30 10:36

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

    0 讨论(0)
  • 2021-01-30 10:36

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

    /p:DefaultPackageOutputDir="\\Rdevnet\Visual Studio Projects\Insurance\"

    0 讨论(0)
  • 2021-01-30 10:38

    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' 
    
    0 讨论(0)
  • 2021-01-30 10:39

    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!

    0 讨论(0)
  • 2021-01-30 10:39

    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"
    
    0 讨论(0)
  • 2021-01-30 10:41

    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

    0 讨论(0)
提交回复
热议问题