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

查看:24
本文介绍了在使用自包含应用程序之前,您是否必须在系统上安装 .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天全站免登陆