在Mac或Windows上运行.NET Core控制台应用程序 [英] Running a .NET Core Console Application on Mac or Windows
问题描述
我已经创建了一个.NET Core控制台应用程序。我想要构建该应用程序,以便可以在Windows或MacOS上执行它,而无需在计算机上安装dotnet核心。所以我需要对于Windows exe。
I've created a .NET Core console application. I want to build the app so that I can execute it on Windows or MacOS without dotnet core being installed on the machine. So I need e.g. for windows an exe.
我已阅读 https://docs.microsoft.com/de-de/dotnet/articles/core/tools/dotnet-publish ,并且我知道如何针对
I've read https://docs.microsoft.com/de-de/dotnet/articles/core/tools/dotnet-publish and I know how to compile the application for the different platform(s).
但没有创建可执行文件。我在这里想念的是什么,我该如何实现我的目标?
But no executable gets created. What am I missing here and how do I accomplish my goal?
推荐答案
您需要创建一个自包含应用程序。链接说明了如何完全修改project.json来做到这一点。
What you need is to create a self-contained application. The link explains how exactly to modify your project.json to do that.
还请注意,尽管一个独立的应用程序不依赖.Net Core,可能还有其他依赖性。特别是在OSX上,我认为您需要从自制软件安装特定版本的openssl。
Also note that while a self-contained application does not have a dependency on .Net Core, it may have other dependencies. Specifically on OSX, I believe you will need to install a specific version of openssl from homebrew.
这篇关于在Mac或Windows上运行.NET Core控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!