.NET Core auto executable

Asked

Viewed 313 times

2

After creating my first console application with . NET Core on Windows 10 with Visual Studio 2017 copied to my server Linux - Ubuntu 16.04.3 LTS (already with . NET Core installed).

I successfully executed the command:

Windows

> dotnet minhaApp.dll

Linux

$ dotnet minhaApp.dll

Now I want to have a independent executable, without needing the dotnet to execute. How do?

I wish to execute so:

Windows

> minhaApp.exe

Linux

$ ./minhaApp

2 answers

3


Does not change almost anything. Normally you should set using as target a version of itself . NET Core. What changes is specify where it will run.

For Windows just give this command:

dotnet publish -c Release -r win10-x64

For Linux just change the target, but never did, probably ubuntu.16.04-x64 (see the catalog).

First you need to configure the csproj for the desired targets, something like this:

<PropertyGroup>
    <RuntimeIdentifiers>win10-x64/RuntimeIdentifiers>
</PropertyGroup>

The rest is just like the one you already know how to do.

Documentation.

  • To Linux worked, target Ubuntu.16.04-x64 and then permission to execute: chmod +x minhaapp. If you wish include in your reply.

  • 1

    Permission regardless of this process, is something of the execution of anything.

1

Using Visual Studio itself, right-click on the project that should have the generated executable and then on Publish. Don’t just build it.

Publicar

Then click Edit and set the executable destination. Then click Publish.

Definir destino

Browser other questions tagged

You are not signed in. Login or sign up in order to post.