Do you have to have .net core installed on a system before using self contained apps?

后端 未结 2 607
清酒与你
清酒与你 2021-01-28 08:39

I\'m using Visual Studio 2019 to publish a self contained .net core 2.1 app. Many files are emitted during the publishing (application files as well as core libraries).

相关标签:
2条回答
  • 2021-01-28 09:26

    A self-contained app will contain everything needed to run the app.

    To run the app, there is no dotnet.exe but an executable named as your app. So

    dotnet publish myapp.csproj -r win-x64
    

    will create a myapp.exe by default.

    For linux runtimes (e.g. -r linux-x64) the executable will be extension less and is supposed to be run as ./myapp.

    You only need to install .NET Core components if you want to host a self-contained ASP.NET Core application from IIS, since you will need an IIS module to bootstrap the application. You can use this approach though to run newer or preview versions of the .NET Core runtime that you don't want to install globally.

    0 讨论(0)
  • 2021-01-28 09:38

    Figured this out by using "file" to look at files. Turns out that when you publish app "Foo" for linux, you end up with a file named Foo which is actually an executable the launches your whole app (ie and any libraries it needs, etc).

    In other words, there is no "dotnet" command included or needed. Effectively, Foo takes the place of dotnet executable.

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