【发布时间】:2020-04-13 15:12:38
【问题描述】:
我在 .NET Core 3.1.200 中有一个带有此 PublishProfile 的应用程序,用于定位 osx-x64:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>True</PublishSingleFile>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishTrimmed>False</PublishTrimmed>
</PropertyGroup>
</Project>
我运行了dotnet publish myapp.cproj /p:PublishProfile=profile.xml,最后 /publish 文件夹包含一个文件“myapp”(这是正确的,因为 PublishSingleFile=True)。
但它没有扩展名。如何在 MacOS 上运行?
编辑:我发现我可以简单地使用./myapp 从终端运行它。但是如何通过双击Finder来运行它呢?目前,它显示:
【问题讨论】:
-
长期以来 Mac/Linux 用户都知道什么是控制台应用程序以及如何在终端上运行它们,因此您无需采取任何额外步骤。在 Finder 中双击应该只会触发具有用户界面的应用程序,您应该使用 Xamarin.Mac 等框架进行开发。
-
该应用程序实际上是一个 GUI 应用程序(使用 Avalonia 制作),我的目标不是长期 Mac 用户,而是休闲用户。他们希望在双击图标后立即看到用户界面。
标签: .net macos .net-core avaloniaui