Search code examples
asp.net-core.net-corepublishvisual-studio-2017

Publish .net core app from VS 2017


I am creating a new solution under Visual Studio 2017 Community Edition, it's mainly a .net core web application.

It works perfectly, no problem at all, but we want to deploy it to a Debian machine and to be self contained, so we added the runtime identifiers to the project. So far so good, the problem comes when we want to publish the application (to a directory) for any of the platforms we have, there is no option to specify the target platform and the publish files created are just the .net assemblies, no native modules.

Of course if we use dotnet publish -r (platform) it works as expected, it creates the correct platform files and everything seems to be ok, but is very annoying to have to go to command line to compile it.

So the question is, how can be published a self-contained application for a concrete platform using Visual Studio 2017? Is it even possible or this is still missing?


Solution

  • Currently VS2017 won't do this so you have to drop to the command line and run this.

    dotnet publish -c release -r ubuntu.14.04-x64
    

    Obviously replacing ubuntu for your debian flavour.

    Also this is in my csproj file and you might need it too.

    <OutputType>Exe</OutputType>