使用自包含的应用程序之前,您是否必须在系统上安装.net核心? [英] Do you have to have .net core installed on a system before using self contained apps?

查看:75
本文介绍了使用自包含的应用程序之前,您是否必须在系统上安装.net核心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2019发布自包含的.net core 2.1应用程序.发布期间会发出许多文件(应用程序文件以及核心库).

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).

但是发布的文件中没有包含dotnet.exe.没有dotnet.exe,我将无法启动已发布的应用程序!

But there is no dotnet.exe included in the published files. Without a dotnet.exe I can't launch the published app!

所以我很困惑.必须安装一个系统范围的.net内核才能使用独立的应用程序,如果是这样,那么您肯定不是独立的应用程序.

So I'm confused. Must you have a system wide .net core installed to use self-contained apps, and if so, then you're app certainly isn't self contained.

推荐答案

一个自包含的应用程序将包含运行该应用程序所需的所有内容.

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

要运行该应用程序,没有 dotnet.exe ,而是一个名为应用程序的可执行文件.所以

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

dotnet publish myapp.csproj -r win-x64

将默认创建一个 myapp.exe .

对于linux运行时(例如 -r linux-x64 ),可执行文件的扩展名将减少,并且应以 ./myapp 的身份运行.

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

如果要从IIS托管独立的ASP.NET Core应用程序,则仅需要安装.NET Core组件,因为您将需要IIS模块来引导该应用程序.不过,您可以使用这种方法来运行不想在全球范围内安装的.NET Core运行时的更新版本或预览版本.

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.

这篇关于使用自包含的应用程序之前,您是否必须在系统上安装.net核心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆