MSBUILD : error MSB1008: Only one project can be specified

前端 未结 18 812
眼角桃花
眼角桃花 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:16

    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"

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

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

    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.

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

    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

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

    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:

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

    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 :-)

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