Run dotnet core console app after publish

Viewed 1097

I have created .net core console app with that launchSettings.json:

    {
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:5000/",
      "sslPort": 0
    }
  },
  "profiles": {
    "Built-in ConsoleApp": {
      "commandName": "IISExpress",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "ASPNETCORE_URLS": "http://localhost:5000/"
      }
    },
    "Standalone ConsoleApp": {
      "commandName": "Project",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "ASPNETCORE_URLS": "http://localhost:5000/"
      }
    }
  }
}

In Visual studio 2017 I am using "Standalone ConsoleApp" profile and console app opens.

What is proper way to publish app to other machine ? How can I run app after publish app ?

1 Answers

you can use

dotnet c:\path\MyPublishedFolder\MyPublishedProject.Dll

If you need executable .exe, you can to add net472 or any other net framework into your csprof

<TargetFrameworks>netcoreapp2.1;net472</TargetFrameworks>

or you need to create self contained application. Add

 <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>

or just use

dotnet publish -c Release -r win10-x64
Related