.net-coremsbuilddotnet-publish

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


I am trying to publish my code onto a linux server by using

dotnet publish –-configuration Release

in the terminal command line. This should create a folder in bin/release/publish with all of the files ready to be deployed onto the server.

however, I get an error message which says

"MSBUILD : error MSB1008: Only one project can be specified. Switch: Release" and nothing gets published to the bin folder.

I have created a settings.json folder in the vscode folder

{
 "deploy.reloaded": {
     "packages": [
         {
             "name": "Version 1.0.0",
             "description": "Package version 1.0.0",

             "files": [
                 "Schedule.API/bin/Release/netcoreapp3.0/publish/**"
             ]
         }
     ],

     "targets": [
         {
             "type": "sftp",
             "name": "Linux",
             "description": "SFTP folder",

             "host": "192.168.0.152", "port": 22,
             "user": "webuser", "password": "password",

             "dir": "/var/www/schedule",
             "mappings": {
                 "Schedule.API/bin/Release/netcoreapp3.0/publish/**": "/"
             }
         }
     ]
 }
}

Solution

  • You seem to have a copy/paste error in the first dash here:

    dotnet publish –-configuration Release
    

    The first dash is (U+2013 : EN DASH). It should be a plain dash - (U+002D : HYPHEN-MINUS), like the second one. This should work:

    dotnet publish --configuration Release